autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How To Configure for Android?


From: Jeffrey Walton
Subject: How To Configure for Android?
Date: Mon, 7 Oct 2013 14:56:57 -0400

Hi All,

I'm trying to cross compile libxml2
(http://www.xmlsoft.org/downloads.html) for Android. libxml2 use
autotools.

I have a script the detects the Android NDK gear and sets the
environment, path, CPP, CC, CXX, AS, AR, LD, SYSROOT, etc. It works
great for projects such as Botan, Crypto++, Cryptlib, OpenSSL,
libcurl, etc. For example:

  $ echo $CPP
  arm-linux-androideabi-cpp
  $ echo $CC
  arm-linux-androideabi-gcc
  $ echo $ANDROID_NDK_ROOT
  /opt/android-ndk-r9
  $ echo $ANDROID_SYSROOT
  /opt/android-ndk-r9/platforms/android-14/arch-arm
  $ echo $CFLAGS
  --sysroot=/opt/android-ndk-r9/platforms/android-14/arch-arm
  $ echo $PATH
  
/opt/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin:
  /opt/android-sdk-macosx/tools/:/opt/android-sdk-macosx/platform-tools/:
  /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
  /opt/X11/bin:/usr/local/MacGPG2/bin
  ..

Building libxml2 is having some trouble. When I try to configure:

$ ./configure --host=arm --build=arm --with-sysroot=$ANDROID_SYSROOT
checking build system type... arm-unknown-none
checking host system type... arm-unknown-none
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 make supports nested variables... yes
checking for arm-gcc... arm-linux-androideabi-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/jwalton/libxml2-2.9.1':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

When I check the log:

$ cat config.log
...
configure:3612: checking whether we are cross compiling
configure:3620: arm-linux-androideabi-gcc -o conftest
--sysroot=/opt/android-ndk-r9/platforms/android-14/arch-arm
conftest.c  >&5
configure:3624: $? = 0
configure:3631: ./conftest
./configure: line 3633: ./conftest: cannot execute binary file
configure:3635: $? = 126
configure:3642: error: in `/Users/jwalton/libxml2-2.9.1':
configure:3644: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

I'm not sure why I'm trying to trick the build system with host=arm
since the host is x86_64. And it feels like I am not specifying the
target properly, but `configure --help` does not list any target
configuration options. Even with a `--host=arm`, configure is telling
me to specify a cross compile with `--host`.

I feel like I'm taking stabs in the dark with libxml2. Google is not
being very helpful because the leading dash (i.e., --host) means the
term should be excluded from the search terms.

Would someone be kind and tell me precisely what I should be supplying
to `config`?

Thanks in advance,

Jeff



reply via email to

[Prev in Thread] Current Thread [Next in Thread]