Reputation: 102346
We caught a report by someone trying to port our project to Android with Autotools. Our project is a C++ library that uses STL, and Android makes the developer choose a C++ and STL library. The project is makefile based and does not use Autotools. Instead, it has published procedures for cross-compiling for Android.
The thrust of the report is a header check failed. We believe it failed because Autotools did not use a STL library when performing the check. The STL library is slightly different than --sysroot
. Sysroot will include many headers and libraries, but not an STL headers or libraries because a user is supposed to select one.
I'd like to know how to tell Autotools to use a specific STL library on Android when configuring for the target.
Upvotes: 2
Views: 746
Reputation: 729
the answer is to use both the standalone toolchain and autotools. For example for the generic arm abi, also using c++ stl (gnu is default):
1) first create your standalone toolchain with whatever --stl option you need.
$> ${ANDROID_NDK_ROOT}/build/tools/make-standalone-toolchain.sh --toolchain=arm-linux-androideabi-4.9 --stl=libc++ --platform=android-21 --install-dir=${PWD}/tools/ --force
2) put the toolchain in your path so configure can find the tools
export PATH=${PWD}/tools/bin:${PATH}
2a) the $TRIPLE env var is helpful for configure to check for tools named like
${TRIPLE}-cc
${TRIPLE}-ld
as you will find the tools in the bin directory above are prefixed by "arm-linux-androideabi". So set TRIPLE. In this example it is
export TRIPLE=arm-linux-androideabi
2b) if you don't want to set $TRIPLE, you must set the CC, CXX, and CPP env vars to point to the versions in your new toolchain bin dir, or pass them to configure (I don't know how).
3) finally run autotools and tell it to use the standalone toolchain for it's sysroot
$>./configure --with-sysroot=${PWD}/tools/sysroot --host=${TRIPLE} ...
Upvotes: 1