iOS - Objective C dynamic framework emit bitcode for arch x86_64 (simulator)

Have setup a sample on Github, I'm using Xcode v 9.4.1 https://github.com/iousin/TreeFramework

Basically I'm trying to build my framework to include bitcode in the x86_64 simulator build. I tried various settings and tried building on command line, xcodebuild refuses to include bitcode in my simulator build, however it is very happy to include it in the arm64 (device) build.

All the following commands should be able to run from the same folder the above framework is checked out.

Following are the commands I've tried to build the above framework:

  
 
xcodebuild ENABLE_BITCODE[sdk=iphone*]=YES BITCODE_GENERATION_MODE=bitcode DYLIB_COMPATIBILITY_VERSION=1 -sdk iphonesimulator -configuration Release -target TreeFramework clean build 
xcodebuild OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE[sdk=iphone*]=YES BITCODE_GENERATION_MODE=bitcode -sdk iphonesimulator -configuration Release -target TreeFramework clean build 



xcodebuild OTHER_CFLAGS="-fembed-bitcode" ENABLE_BITCODE="YES" BITCODE_GENERATION_MODE="bitcode" -sdk iphonesimulator -configuration Release -target TreeFramework clean build


Ran the following to verify bitcode is emitted (it doesn't in this case).

  
 
otool -arch x86_64 -l build/Release-iphonesimulator/TreeFramework.framework/TreeFramework | grep LLVM
    
However when I build for a device, bitcode is included.
  
 
xcodebuild -sdk iphoneos -configuration Release -target TreeFramework clean build
    
Verify bitcode is emitted:
  
 
    otool -arch arm64 -l build/Release-iphoneos/TreeFramework.framework/TreeFramework | grep LLVM
Appreciate any help.

Replies

What are you trying to accompilsh? Bitcode is used to recompile distribution builds of an app (App Store, Enterprise, or Ad-Hoc distribution). As the simulator is a development and debugging tool, bitcode does not apply.

Hi @edford,

Thanks for the reply, the requirement for bitcode is to use so that obfuscation tools can be run on the simulator slice before giving it out to other company for development.

I'm happy to live without if it's not possible, just want someone to confirm that it cannot be done. Then I can stop looking into it. 🙂


Regards.

The tools are behvaing as expected, you can't produce bitcode for the simulator architectures.