适用于Android x86_64的Autoconf三重奏?

时间:2015-01-12 03:20:28

标签: android configuration android-ndk cross-compiling autoconf

我想从这个问题来审视这个问题:Android NDK for x86_64 has no reference for bcopy and index。在问题中,海报询问了与Lame sound library相关的Android x86_64和bcopy

我设置了交叉编译环境,设置了工具和sysroot的路径,并导出了CCCXX CFLAGSCXXFLAGS等常见的嫌疑人例如:

$ echo $CC
x86_64-linux-android-gcc
$ which x86_64-linux-android-gcc
/opt/android-ndk-r10d/toolchains/x86_64-4.9/prebuilt/darwin-x86_64/bin/x86_64-linux-android-gcc

$ export CFLAGS="--sysroot=$ANDROID_SYSROOT"
$ echo $CFLAGS
--sysroot=/opt/android-ndk-r10d/platforms/android-21/arch-x86_64

以上通常足以让事情开始。一切都设置正确,我可以使用脚本来构建其他库,如Crypto ++和OpenSSL(稍作调整)。

但是,我无法配置Android x86_64(见下文)。我似乎无法找到合适的三胞胎。

Android x86_64与Autoconf一起使用什么三元组?


在Autoconf,AC" build"是大多数人认为"主持人"和AC"主持人"是大多数人认为"目标"。因此,交叉编译时选项实际上是正确的。

$ ./configure --build=`./config.guess` --host=x86_64-linux-androideabi
checking build system type... i686-apple-darwin12.5.0
checking host system type... Invalid configuration
`x86_64-linux-androideabi': system `androideabi' not recognized
configure: error: /bin/sh ./config.sub x86_64-linux-androideabi failed

$ ./configure --build=`./config.guess` --host=x86_64-linux-android
checking build system type... i686-apple-darwin12.5.0
checking host system type... Invalid configuration
`x86_64-linux-android': system `android' not recognized
configure: error: /bin/sh ./config.sub x86_64-linux-android failed

$ ./configure --build=`./config.guess`
checking build system type... i686-apple-darwin12.5.0
checking host system type... i686-apple-darwin12.5.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... x86_64-linux-android-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in
`/Users/android/lame-3.99.5':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

1 个答案:

答案 0 :(得分:0)

我从GNU FTP站点获取了autoconf-2.69.tar.xz。我在config.guess目录中找到了最新的config.subbuild-aux,并将其用于LAME MP3编码器项目。

三元组似乎是x86_64-linux-android

该项目虽然链接断了。通过创建共享对象的libtool调用编译器驱动程序缺少CFLAGS,因此--sysroot不会传递给链接器。由于缺少系统库,这会导致一堆链接错误,例如crtbegin_so.ocrtend_so.o-lc-ldl

修复此问题是从libmp3lame目录手动运行失败的命令。使用$CC $CFLAGS <rest of project's command>前缀命令。