转自:http://www.cocos2d-x.org/news/307
By zhangxm Posted 8 months ago Comments 20
NDK r10 has problem, refer to [this ticket](https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&groupby=&sort=&id=73907). We suggest you not use it.
If you use NDK r10 to build cocos2d-x v3.2, you will meet a compiling error of all tests and linking error of lua tests.
compiling error
The error message is
This compiling error is fixed in this patch. We are sorry about it.
linking error
After fixing the compiling error, you will meet linking error when building lua test cases or new lua projects
I have created a ticket in Android issue system for it. And NDK developers confirmed it is a bug of NDK r10. And he gave two ways to work around it:
-
requires makefile changes to drop libgcc.a with command line reads "-nodefaultlibs -lstdc++ -latomic -ldl -lm -lc -lcompiler_rt_static"
Because we don't use standalone toolchain, so changing makefile doesn't work for cocos2d-x.
-
use libc++_shared.so and add
LIBCXX_USE_GABIXX:=truein Application.mk which force rebuild libc++ to use gabi++This method requires to use shared library and modify
Cocos2dxActivity.javato load dependened shared library. We don't want to modify like this, because:- We haven't used shared library before which means we haven't tested
- It will make .apk 0.13M bigger then using static library
- Google guy will fix it in next NDK version
conclusion
We suggest you not to use NDK r10. Please use NDK r9d instead. If you want to use NDK r10, the following steps can help you work around it:
- Change
long inttossize_tin the declaration ofBundleReader::tell(). You can refer to this pull request for detail information. - Change
APP_STL:=c++_statictoAPP_STL:=c++_shared, addLIBCXX_USE_GABIXX:=trueinApplication.mk, and modify your java activity code to loadlibc++_shared.so. You can refer to this commitfor more detail information
本文解决使用NDKr10编译cocos2d-x v3.2时出现的编译错误及链接错误问题,并提供绕过方法。
8338

被折叠的 条评论
为什么被折叠?



