Xcode 7 'CrashReporter does not contain bitcode' linker error

人盡茶涼 提交于 2019-11-28 09:02:13

问题


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:

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

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?


回答1:


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.

The source is obtained from here: PLCrashReporter 1.2.1

Unzip the downloaded 1.2.1 source into a folder.

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

Next add the following to the Custom Compiler Settings "Other Warning Flags" section of the project build settings: -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.

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:

xcodebuild -configuration Release -target 'Disk Image'

This will run the build and leave the framework in ./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).




回答2:


There is 2 options.
1. Download PLCrashReporter sources 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.




回答3:


This worked for me, in order to include Rollbar framework in my project:

Within my workspace, I first select my project from the 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




回答4:


Experienced same issue. I built the crash reporter framework from source using https://www.plcrashreporter.org/code

  • Open it in Xcode
  • Select the 'CrashReporter' target with the red bullseye.
  • Build it

Then search in ~/Library/Developer/Xcode/DerivedData/CrashReporter-xxxxxxx to get the .framework bundle




回答5:


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)

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

What should I do to produce the framework with bitcode enabled?



来源:https://stackoverflow.com/questions/32525916/xcode-7-crashreporter-does-not-contain-bitcode-linker-error

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