Xcode 7 'CrashReporter 不包含 bitcode' 链接器错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32525916/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode 7 'CrashReporter does not contain bitcode' linker error
提问by Fabrizio Bartolomucci
I am directly linking PLCrashReporter in my iOS app without using any external tool and now when I try to compile it on Xcode 7 I get link error:
我在我的 iOS 应用程序中直接链接 PLCrashReporter 而不使用任何外部工具,现在当我尝试在 Xcode 7 上编译它时,我收到链接错误:
ld: '.../CrashReporter.framework/CrashReporter(libCrashReporter-iphoneos.a-armv7-master.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
ld: '.../CrashReporter.framework/CrashReporter(libCrashReporter-iphoneos.a-armv7-master.o)' 不包含位码。您必须在启用位码的情况下重建它(Xcode 设置 ENABLE_BITCODE),从供应商处获取更新的库,或为此目标禁用位码。用于架构 armv7
Where do I get the updated framework or the sources to compile them with bitcode enabled and get rid of the error without disabling bitcode for the full project?
我在哪里可以获得更新的框架或源代码来编译它们并启用 bitcode 并在不禁用整个项目的 bitcode 的情况下摆脱错误?
回答by drshock
I ended up addressing this by building PLCrashReporter 1.2.1 from source. This version is the minimum that has had Xcode 7 and iOS9 fixes merged.
我最终通过从源代码构建 PLCrashReporter 1.2.1 来解决这个问题。此版本是 Xcode 7 和 iOS9 修复合并的最低版本。
The source is obtained from here: PLCrashReporter 1.2.1
源码来自这里:PLCrashReporter 1.2.1
Unzip the downloaded 1.2.1 source into a folder.
将下载的 1.2.1 源文件解压到一个文件夹中。
Pull the Xcode project inside that folder up within Xcode and add the following to the Custom Compiler Settings "Other C Flags" section of the project build settings: -fembed-bitcode
将该文件夹内的 Xcode 项目拉到 Xcode 中,并将以下内容添加到项目构建设置的“自定义编译器设置”“其他 C 标志”部分: -fembed-bitcode
Next add the following to the Custom Compiler Settings "Other Warning Flags" section of the project build settings: -Wno-error=unused-command-line-argument
接下来将以下内容添加到项目构建设置的自定义编译器设置“其他警告标志”部分: -Wno-error=unused-command-line-argument
Then close the project from the Xcode GUI. The custom settings are necessary because we are going to build from the command line using xcodebuild to avoid the PLCR deprecation errors, and when doing so the default is only -fembed-bitcode-marker when building a framework this way. We are overriding the default behavior, and need to suppress the hard stop warning this causes.
然后从 Xcode GUI 关闭项目。自定义设置是必要的,因为我们将使用 xcodebuild 从命令行构建以避免 PLCR 弃用错误,并且在以这种方式构建框架时,默认值仅为 -fembed-bitcode-marker。我们正在覆盖默认行为,并且需要抑制由此导致的硬停止警告。
Lastly, from a terminal window prompt within the folder where the zip file of the source including the xcode project file is located run the following:
最后,从包含 xcode 项目文件在内的源 zip 文件所在文件夹中的终端窗口提示中,运行以下命令:
xcodebuild -configuration Release -target 'Disk Image'
xcodebuild -configuration Release -target 'Disk Image'
This will run the build and leave the framework in ./build/Release/PLCrashReporter-1.2.1/iOS Framework
这将运行构建并将框架留在 ./build/Release/PLCrashReporter-1.2.1/iOS Framework
Now, these steps will produce a bitcode enabled framework, but third party crash reporting is incompatible with bitcode (when the App Store recompiles you have no way to get the symbol file from that on the fly build).
现在,这些步骤将生成一个启用 bitcode 的框架,但第三方崩溃报告与 bitcode 不兼容(当 App Store 重新编译时,您无法从即时构建中获取符号文件)。
回答by arturdev
There is 2 options.
1. Download PLCrashReportersources and compile it whit bitcode enabled, and use that in your project.
2. Disable bitcode for your target
Go to your target's Build Settings tab, search for Enable Bitcode
set value to NO.
有2个选项。
1. 下载PLCrashReporter源代码并在启用bitcode 的情况下编译它,然后在您的项目中使用它。
2. 为您的目标禁用位码
转到您的目标的构建设置选项卡,搜索Enable Bitcode
设置值为 NO。
回答by ivoroto
This worked for me, in order to include Rollbar framework in my project:
这对我有用,以便在我的项目中包含 Rollbar 框架:
Within my workspace, I first select my project from the Project Navigator -> my project's target -> Build Settings -> Enable Bitcode = NO
在我的工作区中,我首先从 Project Navigator -> my project's target -> Build Settings -> Enable Bitcode = NO 中选择我的项目
Then I select the PODS from the Project Navigator -> Rollbar Target -> Enable Bitcode = NO
然后我从 Project Navigator -> Rollbar Target -> Enable Bitcode = NO 中选择 PODS
回答by Friggles
Experienced same issue. I built the crash reporter framework from source using https://www.plcrashreporter.org/code
遇到同样的问题。我使用https://www.plcrashreporter.org/code从源代码构建了崩溃报告器框架
- Open it in Xcode
- Select the 'CrashReporter' target with the red bullseye.
- Build it
- 在 Xcode 中打开它
- 选择带有红色靶心的“CrashReporter”目标。
- 建造它
Then search in ~/Library/Developer/Xcode/DerivedData/CrashReporter-xxxxxxx to get the .framework bundle
然后在 ~/Library/Developer/Xcode/DerivedData/CrashReporter-xxxxxxx 中搜索以获取 .framework 包
回答by Fabrizio Bartolomucci
Unfortunately the issue presented itself again. Also when I try to compile again I get:
不幸的是,问题再次出现。此外,当我再次尝试编译时,我得到:
ld: warning: object file (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(cf.o)) was built for newer OSX version (10.6) than being linked (10.5) ld: warning: object file (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o)) was built for newer OSX version (10.6) than being linked (10.5)
ld:警告:目标文件 (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(cf.o)) 是为较新的 OSX 版本 (10.6) 构建的链接(10.5)ld:警告:目标文件(/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o))是为较新的OSX版本( 10.6) 比被链接 (10.5)
Moreover if I set enable bit code at the project level I get an immediate error: target 'CrashReporter-MacOSX-Static' has bitcode enabled (ENABLE_BITCODE = YES), but it is not supported for the 'macosx' platform
此外,如果我在项目级别设置启用位代码,我会立即收到错误:目标 'CrashReporter-MacOSX-Static' 启用了位代码(ENABLE_BITCODE = YES),但它不支持 'macosx' 平台
What should I do to produce the framework with bitcode enabled?
我应该怎么做才能生成启用了位码的框架?