You have two options:
Write Android.mk, which can successfully create libxml, and depend on the result of this in your Android.mk. You can try to create libxml initially (using configure script and make) on your Mac to get an idea of ββwhat files you need to create, and if you need to pass any special flags.
Or, use the libxml configure script and create libxml for Android using the NDK toolkit. You will need to do something like this:
NDK_ROOT=/path/to/ndk API_LEVEL=YOUR_API_LEVEL SYSROOT=$NDK_ROOT/platforms/android-$API_LEVEL/arch-arm export CC="$NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/Darwin-x86/bin/arm-linux-androideabi-gcc" export CFLAGS="--sysroot=$SYSROOT" export LDFLAGS="--sysroot=$SYSROOT" ./configure --host=arm-linux-gnueabi --enable-static --disable-shared make libxml2.la
Technically, the triplet for Android is arm-linux-androideabi , but most configure scripts do not recognize it, and for our purposes, -gnueabi pretty close.
In the end, I suggested make libxml2.la instead of make , because the tests were not built properly. The resulting library will be in the .libs/ folder.
The second method may be a little easier, but if you intend to create your application for several architectures (arm, armv7-a, or maybe even x86 and mips), writing your own Android.mk will save you time in long work.
source share