Configure无法找到工作编译器

Configure is unable to find a working compiler

本文关键字:工作 编译器 Configure      更新时间:2023-10-16

我试图运行configure告诉它使用交叉编译器(Android NDK提供的一个),但它无法找到一个。我做了以下操作(注意,Android NDK根目录在/prod/ndk/):

(在我要编译的文件夹中,位于/prod/workspace/jni/gmp/):

   ./configure 
   --host=arm-linux-androideabi 
   CC=arm-linux-androideabi-gcc 
   LD=arm-linux-androideabi-ld 
   CPPFLAGS="-I/prod/ndk/platforms/android-8/usr/include/" 
   CFLAGS="-nostdlib" 
   LDFLAGS="-Wl,-rpath-link=/prod/ndk/platforms/android-8/arch-arm/usr/lib/ 
   -L/prod/ndk/platforms/android-8/arch-arm/usr/lib" 
   LIBS="-lc"

但是我收到以下错误:

   checking build system type... x86_64-unknown-linux-gnu
   checking host system type... arm-unknown-linux-androideabi
   checking for a BSD-compatible install... /usr/bin/install -c
   checking whether build environment is sane... yes
   checking for arm-linux-androideabi-strip... arm-linux-androideabi-strip
   checking for a thread-safe mkdir -p... /bin/mkdir -p
   checking for gawk... gawk
   checking whether make sets $(MAKE)... yes
   checking whether to enable maintainer-specific portions of Makefiles... no
   checking ABI=standard
   checking whether arm-linux-androideabi-gcc is gcc... yes
   checking compiler arm-linux-androideabi-gcc -nostdlib 
   -I/prod/ndk/platforms/android-8/usr/include/... no, double -> ulong conversion
   configure: error: could not find a working compiler, see config.log for 
   details

帮忙吗?PS:我包括/prod/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/在我的PATH变量。

我不确定这一点,但我想说这一行:

checking ABI=standard

可能意味着configure不是试图为ARM架构构建,而是为桌面…所以当你尝试运行它时,它会尝试使用Android编译器构建桌面,并发现该编译器不起作用。

尝试添加:

--host=arm-linux-androideabi

你可能已经弄清楚了,但是万一你…或者其他人(比如我)遇到这个问题,你应该看看和/或做一些事情

  1. 使用$NDKROOT/build/tools目录下的make-standalone-toolchain.sh来创建一个针对你想要开发的平台的独立工具链。它比在NDK中使用预构建的工具链更容易,并且是推荐使用工具链的方法。
  2. 检查config.log。它将准确地告诉您在配置中错误发生的位置。如果你看一下那个位置,你会更好地了解a)是什么导致了错误,b)如何修复它。