Hi,
Please help!
I’m trying to compile cpp-test (cocos2d-x v3.2) android on a Mac OS X.
Android NDK r10c
Here is the error message I get:
/Users/mikeg/Kits/android-ndk-r10c/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.8/…/…/…/…/arm-linux-androideabi/bin/ld: error: /Users/mikeg/Kits/cocos2d-x-3.2/tests/cpp-tests/proj.android/…/…/…/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
It says to recompile with -fPIC
Maybe it could help, but how I specify this option in cocos console?
Regards,
Mike.
ricardo
November 16, 2014, 5:26pm
#2
Thanks. Already fixed.
Either use NDK r9, or use the latest version from github.
2 Likes
@ricardo Thanks!
ricardo:
Either use NDK r9
Still doesn’t compile:
Running command: compile
Building mode: debug
building native
NDK build mode: debug
The Selected NDK toolchain version was 4.8 !
running: ‘/Users/mikeg/Kits/android-ndk-r9/ndk-build -C /Users/mikeg/Kits/cocos2d-x-3.2/tests/cpp-tests/proj.android -j1 NDK_MODULE_PATH=/Users/mikeg/Kits/cocos2d-x-3.2/tests/cpp-tests/proj.android/…/…/…:/Users/mikeg/Kits/cocos2d-x-3.2/tests/cpp-tests/proj.android/…/…/…/cocos:/Users/mikeg/Kits/cocos2d-x-3.2/tests/cpp-tests/proj.android/…/…/…/external NDK_DEBUG=1’
Android NDK: Invalid APP_STL value: c++_static
Android NDK: Please use one of the following instead: system stlport_static stlport_shared gnustl_static gnustl_shared gabi++_static gabi++_shared none
/Users/mikeg/Kits/android-ndk-r9/build/core/add-application.mk:254: *** Android NDK: Aborting . Stop.
Error running command, return code: 2
APP_STL value not good. What should I use instead of it?
ricardo
November 17, 2014, 3:18pm
#4
Mmmm… ok. Strange.
Just revert to NDK r10c, and then go to external/curl
and the replace the contents of that directory with the contents of this zip file:
https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-21.zip
(just the external/curl directory)
1 Like
itaish
November 18, 2014, 8:15am
#6
Hi,
I also had the exact same problem.
The correct solution would probably be to try and compile libcurl based on the Wiki topic at http://www.cocos2d-x.org/wiki/How_to_compile_libcurl?project_id=cocos2d-x .
I tried using libcurl.a from https://github.com/cocos2d/cocos2d-x-3rd-party-libs-bin/archive/v3-deps-21.zip but got a whole bunch of errors.
What did work for me was:
Download cocos2d-x-2.2.3 from http://cdn.cocos2d-x.org/cocos2d-x-2.2.3.zip .
Extract to a temp director.
Get the libcurl.a From \cocos2d-x-2.2.3\cocos2dx\platform\third_party\android\prebuilt\libcurl\libs\armeabi (4,278,114 bytes) and overwrite the v3.3rc0 libcurl.a at \cocos2d-x-3.3rc0\external\curl\prebuilt\android\armeabi\ (4,562,086 bytes).
Rebuild
Using this version of libcurl.a I was able to correctly build the cpp-tests and successfully deploy it to an Android phone.
Good Luck,
Itai Shaham
1 Like