我需要发布一个启用了位码的框架,但这很麻烦。我将项目设置中的“启用位码”设置为“是”,它可以为真实设备和模拟器干净地构建。
我想测试这个库,所以我将它集成到我为此目的创建的新应用程序中,但现在它只为模拟器构建。当我尝试为真实设备构建时,我得到:
ld: '/path/to/Framework.framework/Company(File.o)' 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. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
就像我说的,我在启用 Bitcode 的情况下构建了它,所以我不确定为什么会发生这种情况。
有任何想法吗?谢谢
AFAIK,当您使用 Xcode 构建应用程序时,它仅在您制作存档时才包含 Bitcode,原因是当只想调试或测试应用程序/库时减少编译时间。
为了确保 Xcode 在每次构建时发出位码,您可以添加-fembed-bitcode
标记为Other C flags
and Other linker flags
:
此外,检查二进制文件是否包含位码的最简单方法是使用otool
and grep
:
otool -l binary_name | grep __LLVM
你会看到一个或多个segname __LLVM
如果有位码则为条目,如果没有则为空输出。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)