I am compiling a simple program with the Android NDK Linux build on Ubuntu Linux 10.0.4.
//no includes!!!
int main()
{
int a = 1, b = 2, c = -1;
return a + b + c - ( a + b + c);
}
When I run this bash script for gcc,
bin='/media/sdb/android-ndk-r8d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86/bin'
rm -r ./obj/*.*
$bin/arm-linux-androideabi-gcc -c ./main.c -o ./obj/main.o
$bin/arm-linux-androideabi-gcc ./obj/main.o -o ./obj/main.exe
the output of gcc gives a message from ld (arm-linux-androideabi-ld) that it terminated as 7 (second comma-delimited is ARM) signal.
This simple program won’t even compile on Linux, please help!
I have installed static tool chain in ubuntu 12.4
copy through adb in android machine and run
this works in my android mobile.
Edit:
for 10.04
Edit2:
Its static compilation here it doesnt use bionic code and it include libraries by copying them into the ELF.
If you want to dynamic compilation or want to depend on bionic code then use
$NDK/docs/STANDALONE-TOOLCHAIN.html https://android.googlesource.com/platform/ndk/+/master/docs/STANDALONE-TOOLCHAIN.html