First of all, I know only basics about makefile and I'm new to Android NDK.
I've got x64 Linux Mint 17.1 and Android NDK r8e, and I'm trying to build NetHack for Android.
As stated in README, basic idea is to modify makefile with local Android NDK path:
NDK = /path/to/android-ndk-r8d
SYSROOT=$(NDK)/platforms/android-9/arch-arm
CC = $(NDK)/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --sysroot=$(SYSROOT)
But I keep getting this error:
cc -m32 -o makedefs makedefs.o ./monst.o ./objects.o /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
Apparently /usr/bin/ld is being used instead of arm-linux-androideabi-ld and it doesn't look for libgcc.a in Android NDK folder. Am I missing some environment variable or make argument?
Thanks.
UPD1
Here's complete output:
touch ../src/config.h-t
/opt/android/ndk/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/opt/android/ndk/android-ndk-r8e/platforms/android-9/arch-arm -DANDROID -Wno-format -fsigned-char -I../include -c monst.c
/opt/android/ndk/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc --sysroot=/opt/android/ndk/android-ndk-r8e/platforms/android-9/arch-arm -DANDROID -Wno-format -fsigned-char -I../include -c objects.c
make[2]: Entering directory `/home/rzhilich/Projects/NetHack-Android/util'
cc -m32 -Wno-format -I../include -c -o makedefs.o makedefs.c
makedefs.c: In function ‘do_rumors’:
makedefs.c:361:2: warning: format not a string literal and no format arguments [-Wformat-security]
Fprintf(ofp,Dont_Edit_Data);
^
makedefs.c: In function ‘do_date’:
makedefs.c:560:2: warning: format not a string literal and no format arguments [-Wformat-security]
Fprintf(ofp,Dont_Edit_Code);
^
makedefs.c: In function ‘do_dungeon’:
makedefs.c:1232:2: warning: format not a string literal and no format arguments [-Wformat-security]
Fprintf(ofp,Dont_Edit_Data);
^
makedefs.c: In function ‘do_monstr’:
makedefs.c:1354:5: warning: format not a string literal and no format arguments [-Wformat-security]
Fprintf(ofp,Dont_Edit_Code);
^
makedefs.c: In function ‘do_permonst’:
makedefs.c:1395:2: warning: format not a string literal and no format arguments [-Wformat-security]
Fprintf(ofp,Dont_Edit_Code);
^
makedefs.c: In function ‘do_objs’:
makedefs.c:1711:2: warning: format not a string literal and no format arguments [-Wformat-security]
Fprintf(ofp,Dont_Edit_Code);
^
makedefs.c: In function ‘do_vision’:
makedefs.c:1866:5: warning: format not a string literal and no format arguments [-Wformat-security]
Fprintf(ofp,Dont_Edit_Code);
^
makedefs.c:1891:5: warning: format not a string literal and no format arguments [-Wformat-security]
Fprintf(ofp,Dont_Edit_Code);
^
cc -m32 -Wno-format -I../include -c ../src/monst.c -o monst.o
cc -m32 -Wno-format -I../include -c ../src/objects.c -o objects.o
cc -m32 -o makedefs makedefs.o ./monst.o ./objects.o
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
make[2]: *** [makedefs] Error 1
make[2]: Leaving directory `/home/rzhilich/Projects/NetHack-Android/util'
make[1]: *** [../util/makedefs] Error 2
make[1]: Leaving directory `/home/rzhilich/Projects/NetHack-Android/src'
make: *** [nethack] Error 2
UPD2
Apparently installation instruction isn't complete. For some reason util folder is not build using Android NDK gcc, but with system default cc. After installing following packages:
- gcc-4.6
- gcc-4.6-multilib
- gcc-arm-linux-androideabi
I've set system default gcc version to 4.6 using update-alternatives
. And it solved my issue.
Makefile.src
) ? This seems to be a complex build procedure where different files are used to produce the "final" makefile. – kebs