我正在尝试在Mountain Lion上使用Android NDK为Android构建库,按照这个指南进行:
但添加
http://masl.cis.gvsu.edu/2012/01/25/android-echoprint/
编译库时,我运行以下命令:cd <path to jni>
<ndk>/ndk-build
I get the following error:
Compile++ thumb : echoprint-jni <= AndroidCodegen.cpp
arm-linux-androideabi-g++: error trying to exec 'cc1plus': execvp: No such file or directory
make: *** [/Users/wingdom/Desktop/obj/local/armeabi/objs/echoprint-jni/AndroidCodegen.o] Error 1
我相信我已经将需要的所有内容添加到了我的路径变量中:
export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:Developer/android-sdk/tools:/Developer/android-sdk/platform-tools:/Developer/android-ndk:/Developer/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin
为了使这个编译,我还需要做什么?我目前正在使用r8b NDK版本,但已经尝试过从6版本一直到最新版本。
编辑:
我尝试了这个解决方案:Error while building android ndk sample project
添加
export PATH=$PATH:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2
执行我的路径时出现此错误:
cc1plus: error: unrecognized command line option "-mbionic"
cc1plus: error: unrecognized command line option "-mthumb"
cc1plus: error: unrecognized command line option "-mfpu=vfp"
/Users/wingdom/Desktop/jni/AndroidCodegen.cpp:1: error: bad value (armv5te) for -march= switch
/Users/wingdom/Desktop/jni/AndroidCodegen.cpp:1: error: bad value (xscale) for -mtune= switch
make: *** [/Users/wingdom/Desktop/obj/local/armeabi/objs/echoprint-jni/AndroidCodegen.o] Error 1
但添加
export CROSS_COMPILER=$PATH:/Developer/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin
不像上面链接中那样有帮助。