I have a framework need to be released with bitcode enabled. I have set "Enable Bitcode" to "YES" in project "Build Settings". And in the Makefile I have the command line like this: xcodebuild OTHER_CFLAGS="-fembed-bitcode" -target MyFramework -configuration ${CONFIG} -sdk iphoneos
. When I run the makefile, I got the error:
clang: error: argument unused during compilation: '-fembed-bitcode-marker'
But when I changed the "Enable Bitcode" to "NO" in "Build Settings". There is no error occurred. And run the command otool -l build/Debug-output/MyFramework.framework/Libraries/libMyFramework.a | grep __LLVM
, I can get segname __LLVM
.
So the questions are:
- "Enable Bitcode" to "YES" can not work with command line
xcodebuild OTHER_CFLAGS="-fembed-bitcode"
at same time? - If we want to build a bitcode enabled framework, we just need adding
OTHER_CFLAGS="-fembed-bitcode"
to the build command or add-fembed-bitcode
to the "Other C Flags" in "Build Settings", right?
After some testing, I think I have gotten my answer, please correct me if I'm wrong. If your framework is not dependence on other projects, when you set those two settings, you will get the error message mentioned above. But if your framework dependence on other projects.For example, you have a workspace, there are two project in it, A project and B project. A project is dependence on B. In this situation, you should set "Enable Bitcode" to "YES" and -fembed-bitcode
at same time. Because when you release your A.framework, the compiler should know where bitcode would be in the B binary. So should turn the "Enable Bitcode" on to mark -fembed-bitcode-marker
in B.