Is it possible to enable bitcode for my xcframework library using Swift 5.1 toolchain

1.1k views Asked by At

Having these flags enabled

ENABLE_BITCODE=YES
BITCODE_GENERATION_MODE=bitcode
OTHER_C_FLAGS=-fembed-bitcode

An .xarchive is successfully built which is then packaged using xcodebuild into a xcframework.

But when it is included in a test app with bitcode enabled, it would complain with

"...does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target."

When it is built with the latest swift (Swift5.3), bitcode is indeed enabled and runs fine.

Why doesn't 5.1 work and is there any documentation pointing to which version where enabling bitcode actually gets properly bundled with the .archive?

1

There are 1 answers

2
Roma On BEST ANSWER

I had similar issue. I figured out that if you are using Swift Toolchain it may crash a lot of things because it somehow doesn't have some specific things from Xcode.

So my advice is to use older Xcode versions. I'm using this approach because I need to publish my framework to customers who uses Swift 5.1

But if you know better explanation of how we can fix this I'll be glad to hear it)