Cannot build archive for XCFrameworks Xcode 12.2 (12B45b)

I am trying to create an XCFramework on Xcode 12.2 (12B45b) and do not get past the archive step for iOS. Simulator archive is created successfully, but because the iOS archive fails so does the -create_xcframework command.

I have followed the instructions outlined here: https://help.apple.com/xcode/mac/11.0/#/dev544efab96

and have built XCFrameworks for other projects without an issue before Xcode 12.2.

My issue is similar to the one from this thread: https://developer.apple.com/forums/thread/658195 except I am not using Cocoapods.

Here are the commands I used to build the archive:

Code Block swift
xcodebuild archive \
-project "MyModule.xcodeproj" \
-scheme "MyModule" \
-destination "generic/platform=iOS Simulator" \
-archivePath "build/ios-sim.xcarchive"


Code Block swift
xcodebuild archive \
-project "MyModule.xcodeproj" \
-scheme "MyModule" \
-destination "generic/platform=iOS" \
-archivePath "build/ios.xcarchive"


Here is the error from the xcodebuild output:

Code Block bash
The following build commands failed:
Ld /Users/username/Library/Developer/Xcode/DerivedData/MyModule-fkvjupapscucufgdksosogqrhicg/Build/Intermediates.noindex/ArchiveIntermediates/MyModule/IntermediateBuildFilesPath/MyModule.build/Release-iphoneos/MyModule.build/Objects-normal/armv7/Binary/MyModule normal armv7
Ld /Users/username/Library/Developer/Xcode/DerivedData/MyModule-fkvjupapscucufgdksosogqrhicg/Build/Intermediates.noindex/ArchiveIntermediates/MyModule/IntermediateBuildFilesPath/MyModule.build/Release-iphoneos/MyModule.build/Objects-normal/arm64/Binary/MyModule normal arm64
(2 failures)
error: the path does not point to a valid framework: /Users/username/mymodule-root-directory/build/ios.xcarchive/Products/Library/Frameworks/MyModule.framework



The build settings for my target are:
  • Build Libraries for Distribution: YES

  • Skip Install: NO

  • Excluded Architectures: arm64 (for "Any iOS Simulator SDK" only) Note: I have tried removing this and still see the error.

I might be missing something, but has something changed recently? Any help is greatly appreciated!
I have a similar issue where my builds with Xcode 12.2 (final, not beta) for debug with device and simulator are fine, but release xcarchives are failing with:

Code Block
/Users/aaron/src/ios/myLibrary/MyLibrary/MyClass.m:9:9: fatal error: module 'MyLibrary' not found
@import MyLibrary;
 ~~~~~~~^~~~~~~~~~~~~~~~
1 error generated.


I noticed my debug builds have a ProcessXCFramework step for my xcframework, but my release xcarchive builds do not.

You can check the Demo project under this repository, it's working. You need to compare it with your project's build settings.

https://github.com/gurhub/surmagic/tree/master/Demo

Also, you can use the surmagic tool to create your XCFrameworks for ease.

Cannot build archive for XCFrameworks Xcode 12.2 (12B45b)
 
 
Q