
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 errorThe error message is
/Users/minggo/SourceCode/cocos2d-x/build/../cocos/./3d/CCBundleReader.cpp:94:23:error:returntypeofout-of-linedeFinitionof'cocos2d::BundleReader::tell'differsfromthatinthedeclarationssize_tBundleReader::tell()^/Users/minggo/SourceCode/cocos2d-x/build/../cocos/./3d/CCBundleReader.h:90:14:note:prevIoUsdeclarationisherelonginttell();
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
/Users/minggo/bin/androID/androID-ndk-r10/toolchains/arm-linux-androIDeabi-4.8/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androIDeabi/4.8/../../../../arm-linux-androIDeabi/bin/ld:error:/Users/minggo/bin/androID/androID-ndk-r10/toolchains/arm-linux-androIDeabi-4.8/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androIDeabi/4.8/libgcc.a(pr-support.o):multipledeFinitionof'_Unwind_GetRegionStart'/Users/minggo/bin/androID/androID-ndk-r10/toolchains/arm-linux-androIDeabi-4.8/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androIDeabi/4.8/../../../../arm-linux-androIDeabi/bin/ld:/Users/minggo/bin/androID/androID-ndk-r10/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_static.a(Unwind-EHABI.o):prevIoUsdeFinitionhere/Users/minggo/bin/androID/androID-ndk-r10/toolchains/arm-linux-androIDeabi-4.8/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androIDeabi/4.8/../../../../arm-linux-androIDeabi/bin/ld:error:/Users/minggo/bin/androID/androID-ndk-r10/toolchains/arm-linux-androIDeabi-4.8/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androIDeabi/4.8/libgcc.a(pr-support.o):multipledeFinitionof'_Unwind_GetLanguageSpecificdata'/Users/minggo/bin/androID/androID-ndk-r10/toolchains/arm-linux-androIDeabi-4.8/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androIDeabi/4.8/../../../../arm-linux-androIDeabi/bin/ld:/Users/minggo/bin/androID/androID-ndk-r10/sources/cxx-stl/llvm-libc++/libs/armeabi/thumb/libc++_static.a(Unwind-EHABI.o):prevIoUsdeFinitionhereclang++:error:linkercommandFailedwithexitcode1(use-vtoseeinvocation)
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:=true in Application.mk which force rebuild libc++ to use gabi++
This method requires to use shared library and modify Cocos2dxActivity.java to 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 int to ssize_t in the declaration of BundleReader::tell(). You can refer to this pull request for detail information.
Change APP_STL:=c++_static to APP_STL:=c++_shared,add liBCXX_USE_GABIXX:=true in Application.mk,and modify your java activity code to load libc++_shared.so. You can refer to this commit for more detail information
NDK r9d url
linux: http://dl.google.com/android/ndk/android-ndk-r9-linux-x86.tar.bz2
windows: http://dl.google.com/android/ndk/android-ndk-r9d-windows-x86_64.zip
mac os x: https://dl.google.com/android/ndk/android-ndk-r9d-darwin-x86_64.tar.bz2
本文转自http://www.cocos2d-x.org/news/307
总结以上是内存溢出为你收集整理的Compiling and linking error when using NDK r10 to build cocos2d-x v3.2全部内容,希望文章能够帮你解决Compiling and linking error when using NDK r10 to build cocos2d-x v3.2所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)