Adding fat library to XCFramework not working in Xcode 12

Viewed 3132

Edit (2020/09/14): This appears to have been an Xcode bug that has now been fixed as of Xcode 12 beta 6.

I am using Xcode 12 to build a static library, and for tvOS, Xcode 12 includes both arm64 and arm64e in the single fat library.

Similarly, when building for the Simulator, Xcode 12 includes both x86_64 and arm64 (Mac Apple Silicon) in a single fat library.

In both cases, I am not able to create an XCFramework that includes these libraries, using the command:

xcodebuild -create-xcframework -output A.xcframework" -library A.a

Attempting to do so results in the error

error: unable to find any architecture information in the binary at 'A.a'

The output from lipo -info A.a clearly indicates both architectures present (arm64 + arm64e and arm64 + x86_64, respectively), so I don't understand why xcodebuild can't recognize and handle it.

I have also attempted to extract the individual architectures into two thin files each (eg. A-arm64.a and A-arm64e.a) and then create the XCFramework with those, but that results in a different error:

Both tvos-arm64e and tvos-arm64 represent two equivalent library definitions.

and

Both tvos-arm64-simulator and tvos-x86_64-simulator represent two equivalent library definitions.

Am I missing something? How does one create an XCFramework from a fat library (or two equivalent thin libraries)?

1 Answers

This appears to have been an Xcode bug that has now been fixed as of Xcode 12 beta 6.

Related