Skip to content

Latest commit

 

History

History
74 lines (60 loc) · 1.99 KB

ANDROID_README.md

File metadata and controls

74 lines (60 loc) · 1.99 KB

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.

Prerequisites

  1. Download Crystax NDK 10.2.1 from https://crystax.net/en/download. You may need about 2 GB free space.

  2. Unpack the contents to ~/android-sdks/. Note that you need about 8 GB extra free space.

  3. Set the enviroment variables:

    NDK_DIR=~/android-sdks/crystax-ndk-10.2.1
    CC_DIR=~/cross-compilers
    
  4. Set

    ARCH=arm
    HOST=arm-linux-androideabi
    
  5. Run

    $NDK_DIR/build/tools/make-standalone-toolchain.sh --ndk-dir=$NDK_DIR --arch=$ARCH --platform=android-21 --install-dir=$CC_DIR/$ARCH
    
  6. Type

    export PATH=$CC_DIR/$ARCH/bin/:$PATH
    
  7. 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.

  8. The static and shared libraries can be found in $CC_DIR/$ARCH/sysroot/usr/lib

  9. Repeat the steps 4-8 above but instead in step 4 use

    ARCH=x86
    HOST=i686-linux-android
    
  10. Repeat the steps 4-8 above but instead in step 4 use

    ARCH=x86_64
    HOST=x86_64-linux-android
    
  11. Repeat the steps 4-8 above but instead in step 4 use

    ARCH=arm64
    HOST=aarch64-linux-android
    
  12. Now you may remove the $NDK_DIR folder and save some disk space.

Compilation

  1. Make sure that the PATH variable is properly set (see step 6 above).

  2. Run

    ../gradlew androidAar
    

    in this directory.

Troubleshooting

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.