6

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)?

Paul R
  • 208,748
  • 37
  • 389
  • 560
Bill Hollings
  • 2,344
  • 17
  • 25
  • AFAICT `xcodebuild -create-xcframework` has a hardcoded list of supported architectures for each platform which was not updated in Xcode 12. It works fine for me when using only architectures supported by Xcode 11, but adding arm64 to a simulator library breaks it and gives this error. – Thomas Goyne Aug 19 '20 at 21:38
  • just check out this might help you https://github.com/bielikb/xcframeworks – TheCodeTalker Sep 05 '20 at 05:53
  • This appears to have been an Xcode bug that has now been fixed as of Xcode 12 beta 6. – Bill Hollings Sep 14 '20 at 20:16
  • Any updates at present? Having the same issue trying to create xcframework for sim64/simx86/device64 Result Both ios-x86_64-simulator and ios-arm64-simulator represent two equivalent library definitions. – Sergey Brazhnik Feb 16 '21 at 13:30
  • 2
    @SergeyBrazhnik Create two separate libraries: one combined (fat) sim64/simx86, and a separate device64 library. Then add them to the XCFramework. – Bill Hollings Feb 17 '21 at 16:51
  • @BillHollings Can you add your answer please. – Ravi May 30 '21 at 10:42
  • @Ravi Done now. In doing so, SO suggests editing the question instead, which is why that's what I had originally done above. – Bill Hollings May 31 '21 at 15:11
  • Also, this might help you: https://github.com/gurhub/surmagic – MGY Mar 08 '22 at 08:40

1 Answers1

0

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

Bill Hollings
  • 2,344
  • 17
  • 25