1

For reasons given at Android gcc sysroot and linker for compiling NDK projects on Ubuntu, I am compiling my Android NDK project with arm-linux-gnueabi-gcc. There are no problems when compiling with no Android-NDK-specific includes, but now to include jni.h,

arm-linux-gnueabi-gcc -static -o main.exe main.c -I'path/to/native_app_glue' -I'/path/to/android-14/arch-arm/usr/include'

I get some cryptic error undefined reference to __sF.

Does anyone know what could be wrong or has anyone gotten Android NDK projects with jni.h to successfully compile with a standalone toolchain like this?

Community
  • 1
  • 1
T. Webster
  • 9,605
  • 6
  • 67
  • 94

1 Answers1

2

Unless you link everything statically, compiling with arm-linux-gnueabi- toolchain will not work because Android uses different sonames than Ubuntu.

Marat Dukhan
  • 11,993
  • 4
  • 27
  • 41
  • could you spell out the `arm-linux-gnueabi-gcc` statement you would use to get this to work? – T. Webster Feb 14 '13 at 04:37
  • 1
    Add `-static` to `CFLAGS`/`CXXFLAGS`. However, you should be careful about licenses: LGPL requires that you provide object files of your program to anyone who requests them. – Marat Dukhan Feb 14 '13 at 04:53
  • Here is what worked for me `arm-linux-gnueabi-gcc -c ./main.c -o ./main.o -static -g --sysroot='/mnt/hgfs/F/android-ndk-r8d/platforms/android-14/arch-arm'` idk how CFLAGS works. – T. Webster Feb 14 '13 at 05:26