Xcode12 error: module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3 compiler

Hi,
I am trying to build my project with Xcode12, and I am running into this error:


<unknown>:0: error: module compiled with Swift 5.2.4 cannot be imported by the Swift 5.3 compiler: /Users/zs/Documents/CJ/branches/CJ-400/SimpleList/Carthage/Build/iOS/PhoneNumberKit.framework/Modules/PhoneNumberKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule


Not sure how to resolve this. I've tried:
  • cleaning the build directory and building again

  • cleaning build dir, plus deleting DerivedData, and restarting Xcode and building again

  • running 'carthage update PhoneNumberKit --platform iOS', and doing another clean build

  • changing the Xcode command-line tool to Xcode 12, and building again

None of these have worked. What else can I try? Why am I getting this error? Would love some more information


Accepted Reply

Finally found a work-around for this. This link should point the way: Carthage Workaround
  • I'm seeing this with Xcode 12.5, and in a playground - the error is relative to PlaygroundSupport. Any ideas how to apply this approach to that?

Add a Comment

Replies

  • bump* Can someone please help? I'm stuck because my project doesn't compile with Xcode12. It was working with Beta1.

Have you found the solution for this ?
No; I have removed PhoneNumberKit from my iOS14 branch for now, so I can work on other stuff, but will need to put it back eventually. Hopefully someone has an idea of what to do in this case .... maybe build from source, which I haven't tried.
i meet the save question in Xcode 12 Beta 4. to resolve it. i try "carthage update --platform iOS --no-use-binaries" but it work when command line tools is Xcode11.6 and report error when command line tools is Xcode12.0
I also have the same problem. Is there any solution for this.
If anyone has any solution for this issue, please let me know. I've tried this:
  • switched Xcode's "Command Line Tools" to use Xcode12-Beta

  • then build again, using "carthage update PhoneNumberKit --platform iOS"

I run into some error with this:

Build Failed
Task failed with exit code 1:
/usr/bin/xcrun lipo -create /Users/zulfishah/Library/Caches/org.carthage.CarthageKit/DerivedData/12.012A8189n/PhoneNumberKit/3.2.0/Build/Intermediates.noindex/ArchiveIntermediates/PhoneNumberKit/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/PhoneNumberKit.framework/PhoneNumberKit /Users/zulfishah/Library/Caches/org.carthage.CarthageKit/DerivedData/12.012A8189n/PhoneNumberKit/3.2.0/Build/Products/Release-iphonesimulator/PhoneNumberKit.framework/PhoneNumberKit -output /Users/zulfishah/Documents/ContactsJournalGit/branches/ContactsJournal-400/SimpleList/Carthage/Build/iOS/PhoneNumberKit.framework/PhoneNumberKit


This usually indicates that project itself failed to compile. Please check the xcodebuild log for more details: /var/folders/kw/s2d4y7hs0lqgx20jhfj6v2000000gn/T/carthage-xcodebuild.oyTkBY.log


When I look inside the carthage-xcodebuild.oyTkBY.log file, it doesn't show any problems, and ends with "BUILD SUCCEEDED".


Not sure what else to try. Would love some help with this.
Thanks.



Finally found a work-around for this. This link should point the way: Carthage Workaround
  • I'm seeing this with Xcode 12.5, and in a playground - the error is relative to PlaygroundSupport. Any ideas how to apply this approach to that?

Add a Comment
bump* Have this problem on XCode 12 release version. Any ideas on how to fix this problem?
I was having the same issue, and searching for the solutions everywhere, at last i found this GitHub thread.

What I did:
  1. cloned my project in a new folder(because I had Xcode 11.7 working on another folder)

  2. ran following Carthage update (which failed).

Code Block
carthage update --platform iOS

3. Then i added (tmp.xcconfig) file in my project root directory, which contains following two lines.
Code Block
EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_simulatorNATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8
EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHSEFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))

4. Then i exported the config file running this
Code Block
export XCODE_XCCONFIG_FILE=$PWD/tmp.xcconfig

5. Finally i ran
Code Block
carthage update --platform iOS --no-use-binaries --cache-builds

Which fixed the issue and i could able to build successfully in Xcode 12.0
I Updated my XCode 12 to XCode 12.4 , and finally error disappeared