Skip to content

How to build OpenBLAS for Android

Kevin Yang edited this page Mar 7, 2016 · 30 revisions

**** Building OpenBLAS for ARMV7 **** Note that if you've build the standalone toolchain, you should export the path to the bin directory of the toolchain:

export PATH=/tmp/my-android-toolchain/bin:$PATH
make HOSTCC=gcc CC=arm-linux-androideabi-gcc NO_LAPACK=1 TARGET=ARMV7

**** Linking OpenBLAS for ARMV7 **** In Android NDK, use the armeabi-v7a-hard ABI. If you are using the Android.mk file, set the following flags:

TARGET_CFLAGS += -mhard-float -D_NDK_MATH_NO_SOFTFP=1
TARGET_LDFLAGS += -Wl,--no-warn-mismatch -lm_hard

If you are using the standalone toolchain to build a standard (or non-standard) make/scons/whatever system, make sure the above C (compile) and LD (link) flags are set in the appropriate places.

For more information, please check hard-float example at android_ndk/tests/device/hard-float/jni/.

**** LAPACK issues ****

The standard OpenBLAS compiles lapack, so you'd have access to function such as 'stptri_' if you linked with libopenblas.a. However, the android version does not compile these libraries. You can try building the libs from this link: https://github.com/simonlynen/android_libs, if you need to use those functions.

(Todo)