I'm encountering a build error when I set 'Enable Bitcode' to 'YES' in the build settings of a project I'm currently working on. The error is:
ld: bitcode bundle could not be generated because '/Users/nick/Library/Developer/Xcode/DerivedData/PROJECTNAME-esksqmlmtpqewpbktcqeqloackeu/Build/Intermediates.noindex/PROJECT.build/Debug-iphoneos/PROJECTNAME.build/Objects-normal/arm64/main.o' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build file '/Users/nick/Library/Developer/Xcode/DerivedData/PROJECTNAME-esksqmlmtpqewpbktcqeqloackeu/Build/Intermediates.noindex/PROJECT.build/Debug-iphoneos/PROJECTNAME.build/Objects-normal/arm64/main.o' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(I've redacted the project name to PROJECTNAME and a variant to PROJECT to post here.)
At first I though it could be due to one of the dependencies this project is using via Cocoapods but they all have 'Enable Bitcode' set to 'YES' and I'd expect to see the name of the offending library in the error message if that was the case. The project uses no frameworks other than those included via Cocoapods (and Apple frameworks).
I've tried deleting the derived data, restarting Xcode as well as clearing the build folder but the error persists.
I've also tried the '-fembed-bitcode-marker' solution as suggested for a similar problem here:
iOS library to BitCode
But I'm not building a static library but an app so perhaps unsurprising it made no difference.
The project is fairly large and has been developed since 2012 so includes Objective-C and Swift. It currently has iOS 8 as deployment target and 11.2 as base SDK. It's never had Bitcode enabled in any dev or production version in the past. We've got Bitcode enabled on similar but more recent projects. We're currently using Xcode 9.2 (9C40b).
I know I could set 'Enable Bitcode' to 'NO' for the project's build settings to 'fix' the error but I'd rather have bitcode enabled for the re-optimisations Apple can do once the binary is uploaded as mentioned here:
Apple Docs - App Thinning
Am I missing a flag in the build settings that fixes this error or perhaps something else? Any advice is much appreciated!
Many thanks,
Nick
After updating to Xcode 10 we tried to generate a Bitcode bundle again for this project and (after trying different build configs) have been able to do so. The config that eventually worked for this project was:
For the Project's and Pod's Build Settings:
'Enable Bitcode' set to 'YES'
Adding '-fembed-bitcode' to 'Other C Flags'
Adding 'BITCODE_GENERATION_MODE' with the value 'bitcode'
These settings were needed for Debug as well as Release. This is because Debug would throw the 'bitcode could not be generated' error (see original question) if we tried to use the '-fembed-bitcode-marker' or 'marker' flags.
We'd have preferred to use the 'marker' variants for Debug as it's quicker to compile but at least we now have something that works!
Related
All kind time of day. The project on Swift uses the SDK for blueTouth printer Mini Thermal Printer POS-5805DD. The libPrinterSDK library (included with the printer) has been added to the root of the project.a and the PrinterSDK header file.h, header-file is connected via bridge, when you run the project on a real device-everything works correctly, no errors occur. But when you try to build a project to upload to the AppStore, at the very end when linovke libprintersdk library.a an error appears:
ld: bitcode bundle could not be generated because
'/Users/ivan/Documents/MyProject/PrinterSDK/libPrinterSDK.a
(GCDAsyncSocket.o)' was built without full bitcode. All object files
and libraries for bitcode must be generated from Xcode Archive or
Install build file
'/Users/ivan/Documents/MyProject/PrinterSDK/libPrinterSDK.a' for
architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If there is any experience of building a project with libPrinterSDK files.a and PrinterSDK.h, I would really appreciate any help. Thanks.
Im not sure your project has turn Enable Bitcode off yet, if not, try to set No like this image below and Archive project again.
If it doesn't work, you can refer here
One of the frameworks I use fails to get built with Bitrise with Xcode9beta stack. I must point out that this is Bitrise-specific issue. Or either, Bitrise/Eureka issue. Eureka is a particular instance of third-party framework.
Project is built well on the local machine, no bitcode-related issues whatsoever. But whenever I run CI, I get that typical log:
❌ ld: bitcode bundle could not be generated because '.../Frameworks/Eureka.framework/Eureka' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '.../Frameworks/Eureka.framework/Eureka' for architecture armv7
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
I followed these guidelines:
iOS library to BitCode
Flag is set.
I have also tried similar settings for head project/target, to no avail.
Any suggestions?
Seems to be a dependency (version) issue:
... was built without full bitcode. All frameworks and dylibs for bitcode must be generated ...
Might be enough to just upgrade the eureka dependency.
Another thing is that Xcode 9 (GM) is also available now, that alone might help.
Edit: a third option; you might have to disable Bitcode in the Xcode / xcodebuild command, as the default changed in Xcode 9 for some configs. See e.g. https://discuss.bitrise.io/t/xcode-archive-significantly-slower-on-xcode-9-0-x-stack-compared-to-xcode-8-3-x-stack/2708/2?u=viktorbenei
Without more log / info unfortunately it's quite hard to say with certainty.
If neither would help, you can also create an issue report at https://discuss.bitrise.io/c/issues/build-issues and the bitrise team will look into it ;)
My project use P2PCamera SDK,but not use Cocoapod,then need depend more lib
error: Invalid bitcode signature
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I can build and run success in Xcode8.2,but is error when i use Xcode8.3
I have this issue when I tried to test with iOS device.The debug configuration with Build Active Architecture Only is set to NO. After I set to YES, I can test with my iPhone.
This will resolve the issue surely.
Maybe the issue because of a third party SDK integrated into your project using Cocoapods.
do the following:
Clear derived data & restart Xcode.
Clean & Build.
Or if you don't mind disabling bitcode: Go to build settings search bitcode and change "Enable Bitcode" to "No".
The problem might be with lAVCtrl_armv7 third party library, you can confirm this by editing valid Architecture to arm64 and re-compile.
For me it helped to "update project to recommended settings" & clean:
https://stackoverflow.com/a/47336130/1884907
When I try to Archive my application on Xcode 7.3.1, I am getting following error:
error: Invalid bitcode version (Producer: '800.0.35.0_0' Reader:
'703.0.31_0') clang: error: linker command failed with exit code 1
(use -v to see invocation)
I was able to successfully Archive my app yesterday, can any one please help me?
i had this error before ...
you may try the following solution it worked for me
search for bitcode keyword in app --> Build Settings and change it to NO
then archive again -->
it should work fine now
Install Xcode 8:
https://developer.apple.com/download/
Xcode 8 GM seed may be used to submit apps to the App Store.
More info:
In my case I updated to the latest Facebook iOS SDK 4.15.1. Since that library was updated with Xcode 8 and I was still using Xcode 7.3.1 it caused the error.
https://developers.facebook.com/docs/ios/change-log-4.x
Updated for Xcode 8 GM and iOS 10.
So, double check 3rd party libraries.
Or if you don't mind disabling bitcode:
Go to build settings search bitcode and change "Enable Bitcode" to "No".
I also faced the same problem, and as suggested by #Nate,
the issue was because of a third party SDK integrated in our project using Cocoapods.
To help me figure out which one of the 15 pods i had in the project was responsible, i did the following:
Create a new xcode project
Copy the Podfile from your original project to the newly created project's directory
Do pod install
Remove one or more of the pods⋆
Archive the new project, and see if it succeeds, if not repeat step 4 till you are able to archive
⋆(you can also try something like binary search, wherein you delete the first half pods in your Podfile and see if the new project archives)
Once you've figured out the library causing the issue, keep downgrading the library by explicitly specifying the version in Podfile, until the project archives successfully.
And then you can use that version of the library to archive and upload to the app store.
If you are using lib or pod that mean that one of them built by a higher version of your current Xcode, you can either update your code or return back to the previous version where the pods were built by your current version.
If you ran pod update check the pods updated if you ran pod install check the dates of the pods comparing to the release date of your Xcode that will will lead you to the responsible pod.
I got it while I was building using Xcode 8.2.1 and the pod built by Xcode 8.3.1
I also faced this error: Invalid bitcode version (Producer: '800.0.24.1_0' Reader: '703.0.31_0') I have googling so many but unable to find the proper solution. I tried Myself and solved this probable
In my case this error occurs after adding FBSDK by drag and drop that we all usually do.
You can resolve this problem by following these steps:
Delete all pod script in build Phases.
Delete the dragged FBSdks file from the project.
Exit xcode and delete 3 things "Pod folder","Podfile.lock" and "Projectworkspace"
Search and add FBSDK pod link in podfile
Install the pod again by using terminal.... now open Xcode archive your project build.
good solutions, but disabling bitcode worked for some people.
edit :- it worked for me too.
but in future your app might be in problem or (build not optimised by Appstore) if your project is **Bitcode Disable **.
Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store.
Note: For iOS apps, bitcode is the default, but optional. If you
provide bitcode, all apps and frameworks in the app bundle need to
include bitcode. For watchOS apps, bitcode is required
So thats why try to figure out error solutions right way.
The error basically says:
The static linker could not correctly link a certain bitcode bundle, which was
produced using Producer: '902.0.39.2', and is being read using Reader:
'900.0.37'.
You can look up at https://gist.github.com/yamaya/2924292 to identify the Xcode versions for the corresponding compiler versions. In the current case, the reader (our Xcode version) is Xcode 9.0, whereas the producer (Xcode version of typically a third party SDK) is Xcode 9.4. The incompatibility between the two is the root cause of this issue.
You may either:
turn off the bitcode as discussed in other answers, or
roll-back the SDK to a previous version that worked well, or
update your codebase to use the newer Xcode version.
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?
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).
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.
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
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
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?