xcodebuild 7.3 can't enable bitcode

隐身守侯 提交于 2019-11-30 08:38:28

I ran into a similar issue yesterday. After some investigation, the problem, that appears when running xcodebuild from a "Run Script" build phase in any Xcode target, seems related with the explicit specification of the toolchain to be used, done with the ENV variable TOOLCHAINS.

Therefore, until Apple releases a fixed version of Xcode 7.3, you can try to add the following command at the beginning of your script:

# workaround for bitcode generation problem with Xcode 7.3 unset TOOLCHAINS

This should be harmless, as this env variable is not set by default when you run xcodebuild from the command line, and this workaround works just fine in my case.

I'm facing the same issue. Just like you, BITCODE_GENERATION_MODE and OTHER_CFLAGS="-fembed-bitcode" are simply ignored, and my builds broke

I did notice that it sometimes work, and sometimes doesn't. It seems that if you build the framework (or aggreate target) for the simulator, the bitcode goes away, no matter what you have in the xcodebuild commands.

I'm using Xcode 7.3, and I have 2 targets : Static Library, and Aggregate target to make the fat framework.

What works for me when it builds a bitcode-less framework, is to:

  • Select the static library target (not the aggregate one), and pick "Generic iOS device"
  • Clean it
  • Select the static library target, but pick a simulator
  • Build it (works, even if it's instantaneous because it hasn't been cleaned)
  • Select the static library target, but pick "Generic iOS device" again.
  • Build it
  • Select the aggregate target for a "Generic iOS device"
  • Finally, build it
  • If this failed, start over. I sometimes need to do it two or three times before it works.

When I do that, my fat library ends up having bitcode.

You can check that your framework has bitcode support easily by running otool -arch armv7 -l <framework_path> | grep LLVM

In order to break it again, simply build the aggregate target for a simulator. The library will still be a fat one, but bitcode's gone.

Somebody surely can find a solution that works everytime, but at least it fixes the issue for me.

I certainly did not have to do that with Xcode 7.2, and I don't know how that works for pure CLI builds.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!