Build dynamic library for android cpp-tests fails

I’m on linux mint 17. I was able to build cpp-tests in cocos2d-js, but it fails in cocos2d-x

I’m trying to build the demo from:
http://www.cocos2d-x.org/docs/manual/framework/native/v3/getting-started/how-to-run-cpp-tests-on-android/en

I entered $ python android-build.py -p 19 cpp-tests

After running for about 1/2 hour it fails:

/home/bruce/Applications/android-studio/ndk/ndk-build -j4 -C /home/bruce/Applications/cocos2d-x/build/…/tests/cpp-tests/proj.android NDK_DEBUG=1 NDK_MODULE_PATH=/home/bruce/Applications/cocos2d-x/build/…:/home/bruce/Applications/cocos2d-x/build/…/external:/home/bruce/Applications/cocos2d-x/build/…/cocos
make: Entering directory /home/bruce/Applications/cocos2d-x/tests/cpp-tests/proj.android' [armeabi] SharedLibrary : libcpp_tests.so [armeabi] Gdbserver : [arm-linux-androideabi-4.8] libs/armeabi/gdbserver [armeabi] Gdbsetup : libs/armeabi/gdb.setup /home/bruce/Applications/android-studio/ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.8/../../../../arm-linux-androideabi/bin/ld: error: /home/bruce/Applications/cocos2d-x/build/../external/curl/prebuilt/android/armeabi/libcurl.a(sha512-armv4.o): requires unsupported dynamic reloc R_ARM_REL32; recompile with -fPIC clang++: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [obj/local/armeabi/libcpp_tests.so] Error 1 make: Leaving directory/home/bruce/Applications/cocos2d-x/tests/cpp-tests/proj.android’
Build dynamic library for project [ /home/bruce/Applications/cocos2d-x/build/…/tests/cpp-tests/proj.android ] fails!

I followed the readme file, which had a slightly different set of instructions to build a different project named cpp-empty-test. This one works. So I think it’s just something missing in this demo:
http://www.cocos2d-x.org/docs/manual/framework/native/v3/getting-started/how-to-run-cpp-tests-on-android/en

1 Like