0

I'm developing a static library which is distributed to a number of developers. Now I faced the problem with bitcode generation. When I include this library to xcode project and try to archive it, linker produces an error

MyModule.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 arm64

I tried all possible things (from here and from here) and nothing helped. Host project remains unarchivable while the bitcode flag is enabled.

Strange thing is that otool -l command says that all modules include a bitcode section. Why xcode project can not be archived then?

Community
  • 1
  • 1
heximal
  • 10,327
  • 5
  • 46
  • 69

2 Answers2

3

If indeed the error is coming from your library (and not from another library or framework in your project), you can compile the static library once again from Xcode 7.

By default - it will add the option "enable_bitcode" in your build settings. Make sure it is set to yes (the default value), and that all other sources compile with the lib support bitcode as well (if not - you'll receive error) - and you good to go.

The alternative is to enable_bitcode = no in Xcode projects that using your library (inform your developers).

DocForNoc
  • 346
  • 2
  • 13
  • I know I need to recompile the library, and I did it many times with different options including enable_bitcode=YES. the host project still produces the error about missing bitcode section in one of library modules – heximal Oct 19 '15 at 12:58
  • Probably one of the modules using or depend in external or 3rd party library that doesn't support bitcode. Try to isolate the module, it must hide there. – DocForNoc Oct 19 '15 at 13:20
  • sorry I just noticed that you've been giving me a clue in this comment. thanks for spending your time, i'm upvoting your answer – heximal Apr 22 '16 at 20:30
0

Traditionally I'm answering my own question) Hopefully this will be useful for someone in future.

The problem was actually not in my own third-party framework. I had old version of FacebookSDK linked to my host project, and in fact the linker required to recompile it (or request a new version from vendor) instead of my own library.

That's definitely strange and confusing why linker was reporting an error in one of my library modules. There is no connection between my library and FacebookSDK.

heximal
  • 10,327
  • 5
  • 46
  • 69
  • Be careful with this too: Im sure you had a Bolts.framework too. This was moved to be internally referenced by the new FBSDK framework. However, Parse (if you have it) will require a Bolts.framework, and THAT needs to be obtained from Parse. The old (FacebookSDK) Bolts can cause compiler issues. – Aggressor Oct 19 '15 at 17:06
  • Thanks for recommendation. I'm planning to stop using FacebookSDK and use native Accounts framework instead. – heximal Oct 19 '15 at 20:23