2
votes

When compiling cocos2d-js for AppleTV project I receive this error:

ld: '/Users/pepa/Library/Developer/Xcode/DerivedData/GameXY-gwkkxwmtiilmalhdxfdjgqdfhedy/Build/Products/Debug-appletvos/libcocos2d tvOS.a(bio_lib.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE) or obtain an updated library from the vendor for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

I believe that I've included only libs built for AppleTV target with bitcode enabled. But the compiler is still complaining. Is the hint to tell which library miss the bitcode in the brackets? (bio_lib.o)

If so, would you know which library it belongs to? I did not find it on my computer. I'm using the prebuilt binaries from here: https://github.com/elvman/cocos2d-x-3rd-party-libs-bin/tree/tvos

2
The library with missing bitcode is libcocos2d tvOS.a. - trojanfoe
I forgot to mention it in the description. The libcocos2d tvOS.a is a subproject which consist of many libs. One of them is causing the problem and none of them is called bio_lib. This is the only lead I see in the brackets after the main lib name. - PerfectGamesOnline.com
I don't know what you expect us to do? - trojanfoe

2 Answers

2
votes

Use next steps:

  1. Install git, make, autoconf, automake, libtool. If you are using Homebrew this can be done by:

    brew install git make autoconf automake libtool

  2. Clone repository:

    git clone https://github.com/cocos2d/cocos2d-x-3rd-party-libs-src.git

  3. Go to cocos2d-x-3rd-party-libs-src/build and change 2 lines in file tvos.ini:

    cfg_build_release_mode="-O3 -DNDEBUG -fembed-bitcode"

    cfg_build_debug_mode="-O0 -g -DDEBUG -fembed-bitcode"

  4. Run build script:

    build.sh -p=tvos --libs=curl --arch=arm64,x86_64 --mode=release

  5. update libcurl.a crypto and ssl library

1
votes

Ok for anyone coming here trying to build cocos2d-x (3.10) for iOS using Bitcode enabled. I did it, based on the answer of user1675169 ( https://stackoverflow.com/a/33969215/129202 ) but of course I replaced the os in the build.sh line, and I had to replace all of these one by one:

  • libtiff.a
  • libwebp.a
  • libchipmunk.a
  • libjpeg.a
  • libpng.a
  • libfreetype.a

It took me a while to replace each and everyone of these. Depending on what you use in your cocos2d-x project, you might need to replace other libraries as well. Probably in the end cocos2d-x 3.11 will be delivered with all of these libraries recompiled with bitcode enabled in the first place.

A recompile line could look like this:

build.sh -p=ios --libs=tiff --arch=arm64,x86_64 --mode=release

In the end I was able to precompile the whole libcocos2d with bitcode enabled. I haven't tried sending this to iTunes Connect yet but I guess it might actually work in the end.