Xcode 12 Build Errors

Error Message: building for iOS Simulator, but linking in XXX built for iOS, architecture arm64

If you are not using Apple Silicon processor, the reason is that Xcode 12 does not allow build arm64 architecture for Simulator. We should set x86_64 for Simulator building by excluding arm64 via Build Settings -> Excluded Architectures:

Recompile the project again.

If you are using Apple Silicon processor, EXCLUDED_ARCHS for arm64 on the simulator means that people with Apple Silicon macs won't be able to use your framework. Therefore, don't do that. Check the warning messages for your target to identify other conflicts.

Cannot find VALID_ARCHS?

Forget about it. The Build Settings editor no longer includes the Valid Architectures build setting (VALID_ARCHS), and its use is discouraged. Instead, there is a new Excluded Architectures build setting (EXCLUDED_ARCHS). If a project includes VALID_ARCHS, the setting is displayed in the User-Defined section of the Build Settings editor.

Two libraries have the same architectures and in the same fat output file?

fatal error: lipo: /Users/pacowong/Library/Developer/Xcode/DerivedData/Demo-iOS-gxavdlvyqcmylawrmtuqoebcsva/Build/Products/Debug-iphoneos/libSVGKit-iOS.2.1.0.a and /Users/pacowong/Library/Developer/Xcode/DerivedData/Demo-iOS-gxavdlgvyqcmylawrmtuqoebcsva/Build/Products/Debug-iphonesimulator/libSVGKit-iOS.2.1.0.a have the same architectures (arm64) and can't be in the same fat output file

To resolve the conflict in Xcode, go to Build Settings -> Excluded Architectures, set set the following:

If you only have a .a or .framework file, you need to use lipo remove to remove the library that uses arm64 architecture. This can be done using the following command:

$ lipo XXX.a -remove arm64 -output XXX.a

Still does not work?

You need to set it for ALL targets. You can find the targets in Issue Navigator (but not in Project navigator, which is quite weird). You need to modify excluded architectures accordingly.


[1] https://stackoverflow.com/questions/63993084/problems-after-upgrading-to-xcode-12ld-building-for-ios-simulator-but-linking

[2] https://stackoverflow.com/questions/64123206/xcode-12-problems-build-input-file-cannot-be-found-building-for-release-on

[3] https://stackoverflow.com/questions/63259053/xcode-12-beta-valid-architectures-missing-in-build-settings

[4] https://blog.csdn.net/huawt520/article/details/109305833


發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *