Yesterday while building a project that I work on, I started receiving an error when building in release configuration.
clang: error: argument unused during compilation: '-fembed-bitcode-marker'
Now, I am building the project as a fat framework, by batching the simulator and device binaries together.
By default, only archive builds generate bitcode, for my library, I want to generate bitcode for the release build. To achieve that, I pass the
-fembed-bitcode flag when building.
-fembed-bitcode and its debug counterpart
-fembed-bitcode-marker are set like this:
//:configuration = Debug OTHER_CFLAGS = -fembed-bitcode-marker //:configuration = Release OTHER_CFLAGS = -fembed-bitcode
After an hour of reading documentation and experimenting, I was able to isolate the build issue, it appears that I cannot set the
-fembed-bitcode in release by hand.
When setting it, the build fails with the error above, (
-fembed-bitcode flag from the release configuration did in fact solve the issue, but removing it meant that my
iPhoneSimulator builds won't include bitcode anymore.
Now that I understood the issue, the solution became clear, I need to pass
-fembed-bitcode when building for release and for the simulator only. That meant I have to update the c-flags like this:
//:configuration = Debug OTHER_CFLAGS = -fembed-bitcode-marker //:configuration = Release OTHER_CFLAGS = OTHER_CFLAGS[sdk=iphonesimulator*] = -fembed-bitcode
Cleaning and building (and a deleting derived data of-course) confirmed that the issue was fixed. Woot!!
In conclusion, it appears that we cannot pass
-fembed-bitcode when building for release for the iphoneos target, the issue might be that the flag is already set by us from Xcode and the flags will collide...maybe?
If you know more info about this, or if you know a better way to fix it, ping me on twitter @ifnottrue