简体   繁体   English

Make继续使用原生gcc而不是Android NDK

[英]Make keeps using native gcc instead of Android NDK

First of all, I know only basics about makefile and I'm new to Android NDK. 首先,我只知道关于makefile的基础知识,而且我是Android NDK的新手。

I've got x64 Linux Mint 17.1 and Android NDK r8e , and I'm trying to build NetHack for Android . 我有x64 Linux Mint 17.1和Android NDK r8e ,我正在尝试为Android构建NetHack

As stated in README , basic idea is to modify makefile with local Android NDK path: README中所述 ,基本思想是使用本地Android NDK路径修改makefile:

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 cc -m32 -o makedefs makedefs.o ./monst.o ./objects.o / usr / bin / ld:在搜索时跳过不兼容的/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a 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. 显然使用/ usr / bin / ld而不是arm-linux-androideabi-ld ,它不会在Android NDK文件夹中查找libgcc.a Am I missing some environment variable or make argument? 我错过了一些环境变量还是参数?

Thanks. 谢谢。

UPD1 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 UPD2

Apparently installation instruction isn't complete. 显然安装说明不完整。 For some reason util folder is not build using Android NDK gcc, but with system default cc . 由于某种原因, util文件夹不是使用Android NDK gcc构建的,而是使用系统默认cc After installing following packages: 安装以下包后:

  • gcc-4.6 GCC-4.6
  • gcc-4.6-multilib GCC-4.6-multilib的
  • gcc-arm-linux-androideabi GCC-臂-Linux的androideabi

I've set system default gcc version to 4.6 using update-alternatives . 我使用update-alternatives将系统默认gcc版本设置为4.6。 And it solved my issue. 它解决了我的问题。

see how iw http://z4ziggy.wordpress.com/category/aircrack/ 怎么看iw http://z4ziggy.wordpress.com/category/aircrack/

and tcpdump are built https://github.com/chatch/tcpdump-android.git tcpdump构建https://github.com/chatch/tcpdump-android.git

The important thing is 重要的是

    echo "| CREATING TOOLCHAIN |"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Android NDK生成的本机可执行文件与使用Raspbian的gcc-arm为Rasberry Pi生成的本机可执行文件有何不同(pi工具) - How is a native executable built using Android NDK different from that built for Rasberry Pi using gcc-arm for Raspbian (pi-tools) 使用arm-linux-androideabi-gcc和android ndk编译对象时出现问题 - Problems compiling object using arm-linux-androideabi-gcc and android ndk 使用Android NDK构建VPNC - Build VPNC using Android NDK 使用 Android NDK 编译 libpcap - Compile libpcap using Android NDK 是否需要为Android NDK开发计划本机代码中的timertask? - Need to schedule a timertask in native code for android ndk development? Android NDK-使用localhost时套接字关闭 - Android NDK - socket closing when using localhost Linux下使用ndk的Android中的ObjC代码 - ObjC code in Android using ndk under Linux 多个sysroot导致从makefile到错误的gcc调用假定Android NDK路径。 - Multiple sysroot results in gcc calls from makefile to erroneous assume Android NDK path. 使用最新的GCC5或GCC6编译Android ROM和内核 - Using latest GCC5 or GCC6 to compile Android ROM and Kernel 使用AndroidStudio + gradle + NDK 构建Android 和Linux 库 - Using AndroidStudio + gradle + NDK to build Library for Android and Linux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM