-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Compiling OpenBLAS for Android #2005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You need to set heaps of NDK variables (SYSROOT etc) so that crt1.o for target architecture is found by clang. It is ELF file header objects, you cannot run any C program without it. |
The wiki page definitely needs revision, at the very least the instructions for the current clang-based NDK need to be moved to the top. The problem with these pages is that they are often built from what was reported to work in some issue ticket at some time. Maybe the NDK has become better at providing sane defaults for SYSROOT etc. , or maybe it all depends on where you happened to install it. |
And OpenBLAS 0.2.20 is rather old. gcc was deprecated in ndk well after it. |
Apologies, that was a typo. I'm using the latest version 0.3.5. I've corrected my original comment. |
https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android |
@brada4 I started this issue to share a simple method to build OpenBlas for Android, hoping it would help someone. I've compiled OpenBlas successfully using the simple steps mentioned above, I have no issues, I can close this issue now. Thank you. |
@santo4ul which NDK version are you using ? The complicated instructions may have been necessary for older ones - and I notice from the page you linked to that from NDK r19 the standalone toolchain will even be the default. That long and convoluted page in the wiki really needs updating. |
Hi @martin-frbg, I'm using NDK R17. However, I believe it should be same with R19 as well. I agree, the complicated instructions might be required for older NDK versions. |
refer to your steps and ndk guides, built successfully with ndk r20, hope to help someone in need cd $OPENBLAS_SOURCE
export NDK=${HOME}/Android/sdk/ndk-bundle
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
make \
TARGET=ARMV7 \
ONLY_CBLAS=1 \
CC=$TOOLCHAIN/bin/armv7a-linux-androideabi21-clang \
AR=$TOOLCHAIN/bin/arm-linux-androideabi-ar \
HOSTCC=gcc \
ARM_SOFTFP_ABI=1 \
-j4
make PREFIX=./android-openblas/armv7a install cd $OPENBLAS_SOURCE
export NDK=${HOME}/Android/sdk/ndk-bundle
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64
make \
TARGET=CORTEXA57 \
ONLY_CBLAS=1 \
CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang \
AR=$TOOLCHAIN/bin/aarch64-linux-android-ar \
HOSTCC=gcc \
-j4
make PREFIX=./android-openblas/arm64 install |
Hi,
Im using OpenBLAS version v0.3.5.
I tried following instructions from here. I also tried followed discussion from #804. All these seemed quite complicated to build libopenblas.so for Android. I got errors like, "crtbegin_so.o not found", etc.
Later I built libopenblas.so using the below simple commands, and libopenblas.so was built like a charm.
Step 1: Install standalone toolchain as given here (Choose your API level accordingly)
Step 2: export PATH=$PATH:/your/toolchain_dir/bin/
Step 3: Make OpenBLAS using the below make command
make TARGET=ARMV8 ONLY_CBLAS=1 AR=aarch64-linux-android-ar CC="aarch64-linux-android-clang" HOSTCC=gcc -j4
No errors while building libopenblas.so.
I believe this is the right way to build libopenblas.so for Android. Request you to review the above commans and upate the Android build Wiki instructions accordingly.
Thanks,
San
The text was updated successfully, but these errors were encountered: