2

I am trying to compile a Swift application for Archive (testing build), however i'm facing a very strange and isolated error:

error: Invalid bitcode version (Producer: '800.0.38.0_0' Reader: '703.0.31_0') clang: error: linker command failed with exit code 1 (use -v to see invocation)

The weird thing is the app compiles to a device, test suites run and a standard (CMD+B) build action all succeed. The only action that fails is Product > Archive.

Additional Information: I'm using Cocoapods and have confirmed all pods are looking at a Swift 2.3 branch and compatible with my app. Lastly, I tried this build on a completely different dev machine (MacPro) and have hit the same snag.

Newest Information: When I disable bitcode in Build Settings it compiles properly. I'm left to believe this is an issue with one of the pods, possibly not built with the proper flags. If anyone has further insight as i'd like to keep bitcode enabled, if at all possible.

Any help is greatly appreciated.

mkeefe
  • 46
  • 8
  • 1
    Try setting `Enable Bitcode = NO` in Build Settings of your target. – Santosh Sep 20 '16 at 23:43
  • @Santosh - I was editing as you commented. That did the trick. However I would like to know what the issue was. Is there any adverse effects to disabling bitcode? – mkeefe Sep 20 '16 at 23:45
  • 1
    Read this, you will get to know its impact: http://stackoverflow.com/questions/31088618/impact-of-xcode-build-options-enable-bitcode-yes-no – Santosh Sep 20 '16 at 23:49
  • Thank you. Always nice to dive into the "why". If you add your comment as a question i'll mark and close this request. – mkeefe Sep 20 '16 at 23:58

2 Answers2

4

Disable ENABLE BITCODE in Build Settings of your target and try to Archive it. Disabling ENABLE BITCODE does not have any adverse effect on product archive. Since this is an optional flag for Apple, so you can disable it unless Apple makes it required flag in the future. For more details, you can refer to Bitcode Enabling/Disabling

Community
  • 1
  • 1
Santosh
  • 2,900
  • 1
  • 16
  • 16
2

I've got exactly the same issue after upgrading one of 3-rd party libraries. I guess this is because the 3-rd party library was built using Xcode 8 and I'm still on Xcode 7. See also this question on the topic (not yet answered).

Possible fixes would be to:

1) update the Xcode (but I didn't try it yet hoping to find a simpler solution)

OR

2) find out which of the libraries causes the error and either ask them for a fixed version or fallback to a previous version.

UPDATE: Option 2 helped me. The 3-rd party library developer (Bugsee) sent me a new framework compiled with Xcode 7 and everything works now.

Be careful updating 3-rd party frameworks if you are on an older Xcode version for some reason.

Community
  • 1
  • 1
Vitalii
  • 4,267
  • 1
  • 40
  • 45
  • I don't believe updating Xcode will work, it has to do with how the library was built. At this point the best "workaround" is to disable BITCODE as its an optional for Apple, for now. – mkeefe Sep 21 '16 at 13:51