Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ndk-r8 "error trying to exec 'cc1plus': execvp: No such file or directory"

I am trying to use the Android NDK on Mountain Lion to build a library for Android, following this guide

http://masl.cis.gvsu.edu/2012/01/25/android-echoprint/

When it comes time to compile the library, I run:

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

I believe I have added everything I need to to my path variable:

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

What else do I need to do in order to get this to compile? I am using the r8b NDK currently, but have tried it with versions all the way back to 6.

EDIT:

I tried this solution: Error while building android ndk sample project

adding

export PATH=$PATH:/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2

to my path gets me this error:

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

but adding

export CROSS_COMPILER=$PATH:/Developer/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin

doesn't help, like it did in the link above.

like image 561
Wingdom Avatar asked Sep 14 '12 23:09

Wingdom


1 Answers

I have experienced same error.
I was not able to execute even 'gcc, g++' command. So I have googled a lot to find solution, but nothing helped for me.

Then, I found that some filename in ndk is not correct, with tailing _ on some filename.. (In my case, in toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/arm-linux-androideabi/bin folder, there are gcc_, g++_, c++_ instead of gcc, g++, c++.)
I used The unarchiver to extract NDK archive, so I think there are something wrong with unarchiving procedure.

So I re-downloaded NDK and checked MD5 checksum, then extracted archive using Mac's default archive utility.

Now, the problem has solved.

like image 115
Taeho Kim Avatar answered Nov 02 '22 14:11

Taeho Kim