Autoconf triplet for Android x86_64?

大憨熊 提交于 2019-12-25 04:45:19

问题


I wanted to examine the issue from this question: Android NDK for x86_64 has no reference for bcopy and index. In the question, the poster asked about Android x86_64 and bcopy in relation to the Lame sound library.

I set up my cross-compile environment, set the paths for tools and sysroot, and exported the usual suspects like CC, CXX CFLAGS, CXXFLAGS, etc. For example:

$ 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

And:

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

The above is usually enough to get things started. Everything is set correctly, and I can use the script to build other libraries, like Crypto++ and OpenSSL (with some minor adjustments).

However, I have not been able to configure for Android x86_64 (see below). I can't seem to find the right triplet.

What triplet does Android x86_64 use with Autoconf?


Under Autoconf, AC's "build" is what most people consider "host", and AC's "host" is what most people consider "target". So the options are actually correct when cross compiling.

$ ./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:


I fetched autoconf-2.69.tar.xz from the GNU FTP site. I found the latest config.guess and config.sub in the build-aux directory and used it for the LAME MP3 encoder project.

It appears the triplet is x86_64-linux-android.

The project has a broken link though. The invocation of the compiler driver through libtool that creates the shared object lacks CFLAGS, so --sysroot is not passed to the linker. That causes a bunch of link errors due to missing system libraries, like crtbegin_so.o, crtend_so.o, -lc and -ldl.

The fix for that is to manually run the the failed command from the libmp3lame directory. Prepend the command with $CC $CFLAGS <rest of project's command>.



来源:https://stackoverflow.com/questions/27894831/autoconf-triplet-for-android-x86-64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!