![c 无法创建可执行文件配置脚本](https://linux22.com/image/198512/c%20%E6%97%A0%E6%B3%95%E5%88%9B%E5%BB%BA%E5%8F%AF%E6%89%A7%E8%A1%8C%E6%96%87%E4%BB%B6%E9%85%8D%E7%BD%AE%E8%84%9A%E6%9C%AC.png)
执行的命令:
bash configure \
--enable-option-checking=fatal \
--build=x86_64-unknown-linux-gnu \
--host=i686-linux-android \
--target=i686-linux-android \
--disable-warnings-as-errors \
--enable-headless-only \
--with-jdk-variant=normal \
--with-jvm-variants=client \
--with-cups-include=$CUPS_DIR \
--with-devkit=$ANDROID_DEVKIT \
--with-debug-level=release \
--with-freetype-lib=$FREETYPE_DIR/lib \
--with-freetype-include=$FREETYPE_DIR/include/freetype2 \
--with-boot-jdk=/root/java-se-9-ri/jdk-9
配置日志:
configure:34583: $? = 0
configure:34572: /root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/i686-linux-android/bin/gcc -v >&5
Using built-in specs.
COLLECT_GCC=/root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/i686-linux-android/bin/gcc
COLLECT_LTO_WRAPPER=/root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/bin/../libexec/gcc/i686-linux-android/4.6/lto-wrapper
Target: i686-linux-android
Configured with: /s/ndk-toolchain/src/build/../gcc/gcc-4.6/configure --prefix=/tmp/ndk-andrewhsieh/build/toolchain/prefix --target=i686-linux-android --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/tmp/ndk-andrewhsieh/build/toolchain/temp-install --with-mpfr=/tmp/ndk-andrewhsieh/build/toolchain/temp-install --with-mpc=/tmp/ndk-andrewhsieh/build/toolchain/temp-install --with-cloog=/tmp/ndk-andrewhsieh/build/toolchain/temp-install --with-isl=/tmp/ndk-andrewhsieh/build/toolchain/temp-install --with-ppl=/tmp/ndk-andrewhsieh/build/toolchain/temp-install --disable-ppl-version-check --disable-cloog-version-check --disable-isl-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --with-arch=i686 --with-tune=intel --with-fpmath=sse --enable-initfini-array --disable-nls --prefix=/tmp/ndk-andrewhsieh/build/toolchain/prefix --with-sysroot=/tmp/ndk-andrewhsieh/build/toolchain/prefix/sysroot --with-binutils-version=2.21 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1 --with-gmp-version=5.0.5 --with-gcc-version=4.6 --with-gdb-version=7.6 --with-python=/usr/local/google/home/andrewhsieh/mydroid/ndk/prebuilt/linux-x86_64/bin/python-config.sh --with-gxx-include-dir=/tmp/ndk-andrewhsieh/build/toolchain/prefix/include/c++/4.6 --with-bugurl=http://source.android.com/source/report-bugs.html --disable-bootstrap --disable-libquadmath --enable-plugins --enable-libgomp --disable-libsanitizer --enable-gold --enable-graphite=yes --with-cloog-version=0.18.0 --with-ppl-version=1.0 --enable-eh-frame-hdr-for-static --program-transform-name='s&^&i686-linux-android-&' --enable-gold=default
Thread model: posix
gcc version 4.6 20120106 (prerelease) (GCC)
configure:34583: $? = 0
configure:34572: /root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/i686-linux-android/bin/gcc -V >&5
gcc: error: unrecognized option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:34583: $? = 1
configure:34572: /root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/i686-linux-android/bin/gcc -qversion >&5
gcc: error: unrecognized option '-qversion'
gcc: fatal error: no input files
compilation terminated.
configure:34583: $? = 1
configure:34603: checking whether the C compiler works
configure:34625: /root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/i686-linux-android/bin/gcc -fno-short-enums -D__GLIBC__ -D_GNU_SOURCE -Wno-psabi -march=i686 -msse3 -mstackrealign -mfpmath=sse -fPIE --sysroot=/root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/sysroot -fno-short-enums -D__GLIBC__ -D_GNU_SOURCE -Wno-psabi -march=i686 -msse3 -mstackrealign -mfpmath=sse -fPIE --sysroot=/root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/sysroot -Wl,--unresolved-symbols=ignore-all -Wl,--gc-sections -Wl,-z,nocopyreloc -fPIE --sysroot=/root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/sysroot conftest.c >&5
/root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld: --unresolved-symbols=ignore-all: unknown option
/root/jdk9mobile/android-ndk-r10b/generated-toolchains/android-x86-toolchain/bin/../lib/gcc/i686-linux-android/4.6/../../../../i686-linux-android/bin/ld: use the --help option for usage information
collect2: ld returned 1 exit status
configure:34629: $? = 1
configure:34667: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "OpenJDK"
| #define PACKAGE_TARNAME "openjdk"
| #define PACKAGE_VERSION "jdk9"
| #define PACKAGE_STRING "OpenJDK jdk9"
| #define PACKAGE_BUGREPORT "[email protected]"
| #define PACKAGE_URL "http://openjdk.java.net"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:34672: error: in `/root/mobile-jdk9':
configure:34674: error: C compiler cannot create executables
See `config.log' for more details
答案1
我已经通过使用arm linux-androideabi 工具链修复了这个问题
用来--host=arm-linux-androideabi
--target=arm-linux-androideabi
代替。