问题描述
- arm-linux-androideabi-gcc 交叉编译报错
-
对Linux下的一个开源代码进行交叉编译,准备移植到Android平台上。但是一直报错。编辑脚本如下:
export NDKROOT="/home/bupt/android-ndk-r9d"
export PREBUILT=$NDKROOT/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64
export SYSROOT=$NDKROOT/platforms/android-18/arch-arm
export CC=$PREBUILT/bin/arm-linux-androideabi-gcc
export LD=$PREBUILT/bin/arm-linux-androideabi-ld
export AS=$PREBUILT/bin/arm-linux-androideabi-gcc
export AR=$PREBUILT/bin/arm-linux-androideabi-ar
export RANLIB=$PREBUILT/bin/arm-linux-androideabi-ranlib
export STRIP=$PREBUILT/bin/arm-linux-androideabi-strip
CFLAGS="--sysroot=$NDKROOT/platforms/android-18/arch-arm -fPIC -DX264_VERSION -DANDROID -DHAVE_PTHREAD -D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -fomit-frame-pointer -mfloat-abi=softfp -mfpu=neon -I$TOOLCHAINS_INCLUDE -I$NDKROOT/platforms/android-18/arch-arm/usr/include"
export CFLAGS
LDFLAGS="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$NDKROOT/platforms/android-18/arch-arm/usr/lib -L$NDKROOT/platforms/android-18/arch-arm/usr/lib -nostdlib -lc -lm -ldl -lgcc"
export LDFLAGS
./configure --prefix=/home/bupt/clamav/clamav-0.98.4/clamav-android --host=arm-linux-androideabi --with-openssl=/usr/libconfig.log报错如下:
configure:3820: /home/bupt/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -V >&5
arm-linux-androideabi-gcc: error: unrecognized option '-V'
arm-linux-androideabi-gcc: fatal error: no input files
compilation terminated.
configure:3831: $? = 1
configure:3820: /home/bupt/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -qversion >&5
arm-linux-androideabi-gcc: error: unrecognized option '-qversion'
arm-linux-androideabi-gcc: fatal error: no input files
compilation terminated.home/bupt/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/include-fixed/limits.h:169:61: error: no include path in which to search for limits.h
configure:4461: $? = 1但是在这个文件夹下可以找到这个.h文件。
conftest.c:13:0: fatal error: assert.h: No such file or directory
compilation terminated.其他报错信息都是以上这种找不到头文件等。
命令行报错为:
configure: ****** mempool support disabled (mmap not available or not usable)
checking for ld used by GCC... /home/bupt/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld
checking if the linker (/home/bupt/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld) is GNU ld... yes
checking for shared library run path origin... done
checking check.h usability... no
checking check.h presence... no
checking for check.h... no
configure: unable to compile/link with check
checking for libxml2 installation... not found
configure: ****** libxml2 support unavailable
checking for OpenSSL installation... configure: error: OpenSSL not found.求解决方案!!!!!!!!!!!!!!
解决方案
解决了吗?把所以config文件内容考上来。。差不多是版本问题。gcc