How to compile GMP for android ndk as a static or shared library that I can reuse in my projects/
Asked
Active
Viewed 3,105 times
1 Answers
6
I don't know if GMP use autoconf but if it does then you can try the following:
you will need to follow instruction android-ndk-r6/docs/STANDALONE-TOOLCHAIN.html 3/ Invoking the compiler (the easy way)
Assuming that you have defined $NDKROOT to point to root of NDK
$NDKROOT/build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=$NDKROOT/android_armeabi
export CC="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-gcc --sysroot=$NDKROOT/android_armeabi/sysroot"
export CXX="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-g++ --sysroot=$NDKROOT/android_armeabi/sysroot"
export AR="$NDKROOT/android_armeabi/bin/arm-linux-androideabi-ar"
export SYSROOT="$NDKROOT/android_armeabi/sysroot"
export PATH="$NDKROOT/android_armeabi/bin":$PATH
./configure --host=arm-linux-androideabi
I was able to compile various open source libs with this recipe. Good luck!

Steph
- 1,711
- 2
- 13
- 9
-
I needed to add a line for `ranlib` similar to the `ar` line, then it worked perfectly. – Willem Hengeveld Oct 10 '13 at 15:38
-
@WillemHengeveld did you manage to compile shared and static libs for armeabi-v7a, arm64-v8a, x86 and x86_64 using this method? – vesperto Jan 20 '21 at 11:47