Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use arm-linux-androideabi compiler

I wonder how to use arm-linux-androideabi compiler. That compiler is on android-ndk tool.

There is ndk-build tool on android-ndk tool. To compile ethercat stack, I need only arm-linux-androideabi compiler.

But, I saw this message.

root@ubuntu:/opt/android/android-ndk-r9c/jni# arm-linux-androideabi-gcc -o test test.c
/opt/android/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory
/opt/android/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtend_android.o: No such file or directory
/opt/android/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc
/opt/android/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
collect2: ld returned 1 exit status

How am I supposed to do this?

like image 879
user3247643 Avatar asked Jan 29 '14 07:01

user3247643


1 Answers

You need to let the compiler know where to look for these files. Try using:

arm-linux-androideabi-gcc --sysroot=/opt/android/android-ndk-r9c/platforms/android-19/arch-arm -o test test.c

where 19 is android API level you want to use. You can find more info on docs/STANDALONE-TOOLCHAIN.html in your ndk dir.

like image 160
v3l0c1r4pt0r Avatar answered Sep 30 '22 15:09

v3l0c1r4pt0r