VSTS Build Generation throwing Invalid bitcode version error

Karthick Ramesh picture Karthick Ramesh · Jul 2, 2018 · Viewed 8.4k times · Source

To generate builds to testers we use VSTS in our project. When we checkout and run the branch in our mac with xcode, it works fine. But when i try to release a build through VSTS it throws error as below and the build fails.

ld: could not reparse object file in bitcode bundle: 'Invalid bitcode version (Producer: '902.0.39.2_0' Reader: '900.0.39.2_0')', using libLTO version 'LLVM version 9.0.0, (clang-900.0.39.2)' for architecture arm64

I understand that the issue might be because of the fact that there are two different versions of the compiler hanging around. I am using Xcode 9.2 and the server which builds the source code to upload also has Xcode 9.2. One more thing is, in past i have made a commit with beta Xcode version 9.4 to the branch. Can that create an issue or is it something else that i am missing here.

Also i hear from some stack-overflow and git suggestions that updating Xcode will fix the issue. I am fine with that but want to have that option as last because there are some servers and builds queued in the server like android and WebApp build which we have automated through VSTS which will be stopped momentarily.

Any help or pointers are much appreciated.

Note: Internally the VSTS server tries to archive the build. So the accepted answer in error: Invalid bitcode version (Producer: '800.0.35.0_0' Reader: '703.0.31_0') might provide the solution. But still the scenario is different as VSTS might try something different under the hood.

Answer

Marián Černý picture Marián Černý · Jul 8, 2018

It happened to me when I was trying to create an archive of a project with a binary framework (in my case Crashlytics/Fabric). The framework was compiled using Xcode 9.4, but I was using Xcode 9.2 (looks like 900.0.39.2_0 is Xcode 9.2 and 902.0.39.2_0 is Xcode 9.4). I solved it by temporarily setting Enable Bitcode to No in Build Settings.

Note: Bitcode is not mandatory to submit an iOS app to the App Store. (However it is mandatory for Apple Watch apps.)

Another solution would be to downgrade the binary framework to an older version (built with a compatible version of Xcode).