This tutorial explains how to create Linux -> android-eabi, android-x86 cross compilers and compile the Giac library. The tutorial has been tested on Kubuntu 14.04, Ubuntu 14.10 and Ubuntu 16.04 systems.
-
Download Crystax NDK 10.2.1 from https://crystax.net/en/download. You may need about 2 GB free space.
-
Unpack the contents to ~/android-sdks/. Note that you need about 8 GB extra free space.
-
Set the enviroment variables:
NDK_DIR=~/android-sdks/crystax-ndk-10.2.1 CC_DIR=~/cross-compilers
-
Set
ARCH=arm HOST=arm-linux-androideabi
-
Run
$NDK_DIR/build/tools/make-standalone-toolchain.sh --ndk-dir=$NDK_DIR --arch=$ARCH --platform=android-21 --install-dir=$CC_DIR/$ARCH
-
Type
export PATH=$CC_DIR/$ARCH/bin/:$PATH
-
Optionally check out GMP and MPFR and make them with the following command (for versions see src/jni/prebuilt/android/README.txt):
CFLAGS="-fPIC" ./configure --host=$HOST --prefix=$CC_DIR/$ARCH/sysroot/usr --disable-assembly && make && make install
This step requires additional 300-500 MB disk space.
-
The static and shared libraries can be found in
$CC_DIR/$ARCH/sysroot/usr/lib
-
Repeat the steps 4-8 above but instead in step 4 use
ARCH=x86 HOST=i686-linux-android
-
Repeat the steps 4-8 above but instead in step 4 use
ARCH=x86_64 HOST=x86_64-linux-android
-
Repeat the steps 4-8 above but instead in step 4 use
ARCH=arm64 HOST=aarch64-linux-android
-
Now you may remove the
$NDK_DIR
folder and save some disk space.
-
Make sure that the
PATH
variable is properly set (see step 6 above). -
Run
../gradlew androidAar
in this directory.
You may need to create the file local.properties
on your own
with sdk.dir=/path/to/android/sdk
if you don't want to set the
ANDROID_SDK
variable manually.