[hipl-dev] Re: Android Cross Compilation Issue

  • From: Miika Komu <mkomu@xxxxxxxxx>
  • To: hipl-dev@xxxxxxxxxxxxx, Juhani Toivonen <juhani.toivonen@xxxxxxxxxxxxxx>
  • Date: Tue, 19 May 2015 13:56:32 +0300

Hi Lingyuan,

sorry, I was on a vacation. I hope Juhani can give you some hints on this?

On 05/11/2015 07:32 AM, Lingyuan He wrote:

Hi,

I am cross-compiling HIPL to Android (compatible to android-14 4.0
IceCream Sandwich) using NDK R10d, with most of the script borrowed from
the prepare_android_toolchain.sh, with arm-linux-androideabi-gcc-4.9.

I patched NDK using the patches found in patches/android/ndk, and I also
patched libnefilter_queue.

NDK toolchain was built successfully with:
$NDK_ROOT/build/tools/make-standalone-toolchain.sh
--toolchain=arm-linux-androideabi-4.9 --platform=android-14 --arch=arm
--ndk-dir=$NDK_ROOT --system=linux-x86 --install-dir=$TOOLCHAIN_FOLDER

In compilation, while the dependencies work just fine, I cannot compile
HIPL:
====================================================================
make all-am
make[1]: Entering directory
`/home/lingyuan/Documents/OMNI-Columbia-IRT/android_porting/work/hipl-1.0.8'
CC libcore/builder.lo
In file included from /usr/include/errno.h:29:0,
from libcore/builder.c:89:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such
file or directory
#include <bits/predefs.h>
^
compilation terminated.
make[1]: *** [libcore/builder.lo] Error 1
make[1]: Leaving directory
`/home/lingyuan/Documents/OMNI-Columbia-IRT/android_porting/work/hipl-1.0.8'
make: *** [all] Error 2
make install-am
make[1]: Entering directory
`/home/lingyuan/Documents/OMNI-Columbia-IRT/android_porting/work/hipl-1.0.8'
CC libcore/builder.lo
In file included from /usr/include/errno.h:29:0,
from libcore/builder.c:89:
/usr/include/features.h:324:26: fatal error: bits/predefs.h: No such
file or directory
#include <bits/predefs.h>
^
compilation terminated.
====================================================================


The part of script to compile HIPL works as follow:
=========================================================================================
INSTALL_PATH=$(pwd)/install
TOOLCHAIN_FOLDER=$(pwd)/toolchain
TOOLCHAIN=$TOOLCHAIN_FOLDER/bin/arm-linux-androideabi-
HOST=arm-linux
PKG_CONFIG_PATH=$INSTALL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH
LDFLAGS="-L$INSTALL_PATH/lib" CFLAGS="-I$INSTALL_PATH/include
-DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DOPENSSL_N
-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall -fPIC"
CC=${TOOLCHAIN}gcc AR=${TOOLCHAIN}ar ARD=${TOOLCHAIN}ar
RANLIB=${TOOLCHAIN}ranlib LD=${TOOLCHAIN}ld NM=${TOOLCHAIN}nm
./configure --enable-android --disable-android-pie --host=$HOST
--prefix=$INSTALL_PATH
==========================================================================================

Top lines of configure show expected result:
==============================================
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
checking for arm-linux-gcc...
/home/lingyuan/Documents/OMNI-Columbia-IRT/android_porting/toolchain/bin/arm-linux-androideabi-gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... yes
===============================================

I also attached config.log for reference, where I did not find anything
suspicious.

It appeared to me that the compiler looks into my default /usr/include
folder for header file, and this puzzles me.

Any insight and help?

Thanks,
Lingyuan

Other related posts: