CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
Asked Answered
G

3

12

I'm relatively new to Xcode development. Essentially, the project that I'm working on uses the PolarBleSdk library which also has an RxSwift dependency. I added these as frameworks/compiled modules and both were working without error last week. Today I go to run my project and get the following error:

Module compiled with Swift 5.2 cannot be imported by the Swift 5.3 compiler: /Users/admin/eva-official/eva/eva/ios/PolarBleSdk.framework/Modules/PolarBleSdk.swiftmodule/x86_64-apple-ios-simulator.swiftmodule

I looked into the error on SO, found several of the same issue all with the same solution the most verbose answer is the following:

Module compiled with Swift 5.1 cannot be imported by the Swift 5.1.2 compiler

So when I attempt this solution BUILD_LIBRARY_FOR_DISTRIBUTION = YES; I get this error:

CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'Runner' from project 'Runner')
    cd /Users/admin/eva-official/eva/eva/ios
    export DEVELOPER_DIR\=/Applications/Xcode.app/Contents/Developer
    export SDKROOT\=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name Runner -Onone -enable-batch-mode -enforce-exclusivity\=checked @/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner.SwiftFileList -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.0.sdk -target x86_64-apple-ios12.4-simulator -g -module-cache-path /Users/admin/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -index-store-path /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Index/DataStore -enable-library-evolution -swift-version 5 -I /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Products/Debug-iphonesimulator -F /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Products/Debug-iphonesimulator -F /Users/admin/eva-official/eva/eva/ios/Flutter -F /Users/admin/eva-official/eva/eva/ios -parse-as-library -c -j4 -output-file-map /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner.swiftmodule -emit-module-interface-path /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner.swiftinterface -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Runner-generated-files.hmap -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Runner-own-target-headers.hmap -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Runner-all-target-headers.hmap -Xcc -iquote -Xcc /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Runner-project-headers.hmap -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources-normal/x86_64 -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources/x86_64 -Xcc -I/Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/DerivedSources -Xcc -DDEBUG\=1 -emit-objc-header -emit-objc-header-path /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/Runner.build/Debug-iphonesimulator/Runner.build/Objects-normal/x86_64/Runner-Swift.h -import-objc-header /Users/admin/eva-official/eva/eva/ios/Runner/Runner-Bridging-Header.h -pch-output-dir /Users/admin/Library/Developer/Xcode/DerivedData/Runner-bqvaekbapdxicmavikgdqxwzdbni/Build/Intermediates.noindex/PrecompiledHeaders -working-directory /Users/admin/eva-official/eva/eva/ios

<unknown>:0: error: using bridging headers with module interfaces is unsupported
Command CompileSwiftSources failed with a nonzero exit code

Other steps I've tried:

  • Cleaning the build
  • Removing ~/Library/Developer/Xcode/DerivedData
  • Restarting Xcode
  • Building onto device
Gompers answered 22/9, 2020 at 4:23 Comment(1)
Additionally, the timing is important because I believe Xcode updated because when I rm -rf my project and reclone it warns to update config and the BUILD_LIBRARY_FOR_DISTRIBUTION option is not available, so suspect something in the update.Gompers
G
-9

For anyone stuck in this loop: You have to wait for those dependencies to update to Swift 5.3, otherwise you have to stay on Xcode 11. In my case I updated to 12 during development.

You can download the previous versions here.

Gompers answered 22/9, 2020 at 7:31 Comment(0)
A
4

Follow these steps

  1. Clear de DerivedData folder
  • rm -rf ~/Library/Developer/Xcode/DerivedData
  1. Clean Xcode project
  • cmd + shift + k
  1. Close Xcode project, maybe even reboot the mac (if you like)

Try again. The first step was the crucial step for me, but step 2 and 3 could help as well.

Automobile answered 17/1, 2022 at 19:53 Comment(2)
for me since I am using React Native after clearing the DerivedData folder I also clear Pods, Podfile.lock, node_modules then start it again.Telethermometer
Reboot your Mac? Why not create your own IDE?Demasculinize
V
0

We had a similar problem. The solution that worked for us was changing the architecture of the Terminal App. We switched from arm64 to -x86_64.

user@Mac-mini ~ % arch
arm64
user@Mac-mini ~ % env /usr/bin/arch -x86_64 /bin/zsh --login
user@Mac-mini ~ % arch
i386
Vitriol answered 19/1, 2023 at 14:15 Comment(2)
This came up in my review queue and does not seem to have anything to do with the question at all. Can you please clarify or remove?Estimable
It may not be the answer to the original question but if you have issues with architectures this definitely helps.Underprop
G
-9

For anyone stuck in this loop: You have to wait for those dependencies to update to Swift 5.3, otherwise you have to stay on Xcode 11. In my case I updated to 12 during development.

You can download the previous versions here.

Gompers answered 22/9, 2020 at 7:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.