背景
- OSX 是操作系统
- R8 NDK
我正在尝试使用 Android GCC 编译器编译以下类...
#include <stdint.h>
int main (void){
return 0;
}
我使用以下命令执行...
un@un:~/Development/Code/OpenGL$ ~/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/arm-linux-androideabi-gcc hello.c -o hello
我得到...
In file included from hello.c:1:0:
/Users/un/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/include/stdint.h:3:26: fatal error: stdint.h: No such file or directory
compilation terminated.
因此,由于缺乏 gcc 知识(但有一些谷歌能力),我找到了这个并尝试了一下......
un@un:~/Development/Code/OpenGL$ ~/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/arm-linux-androideabi-gcc hello.c -o hello -ffreestanding
我得到...
/Users/un/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory
/Users/un/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtend_android.o: No such file or directory
/Users/un/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc
/Users/un/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
collect2: ld returned 1 exit status
有人可以帮我解决我做错的事情吗?我错过了链接还是什么?Android.mk 不是一个选项。
更新这也不起作用...
arm-linux-androideabi-gcc hello.c --sysroot=~/Development/Android/android-ndk-r8c/platforms/android-9/arch-arm
/Users/jackiegleason/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtbegin_dynamic.o: No such file or directory
/Users/jackiegleason/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot open crtend_android.o: No such file or directory
/Users/jackiegleason/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lc
/Users/jackiegleason/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: error: cannot find -ldl
collect2: ld returned 1 exit status