-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Android fails to run basic example compiled with openblas (in emulator) #787
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
Is that ld error complete? There should be some library name + preceding command line at least. |
Here is the full output: /tmp/my-android-toolchain/bin/arm-linux-androideabi-gcc -mfloat-abi=hard ex.cpp -I/opt/arm-tools/include /opt/arm-tools/lib/libopenblas.a |
Are you sure these 2 are set?
|
Looking at the build output, I don't think I've set those properly, how can I set those, besides editing Makefile.arm? |
Ok, I think I've figured it out, those flags are meant for when I compile and link ex.cpp, not for compiling the existing library. I'll go ahead and close the issue. |
Closed it a little too fast. I've edited the OpenBLAS wiki page with new build instructions so I can build ex.cpp. The problem now is I cannot run the compiled executable, I can get printouts before the call to cblas_dgemm, but not after. Here's how I'm running it.
Here's I get that the shell exited (no printouts). I don't have a segfault, but I don't get the expected printout of the matrix either. |
So are you building with hardfp or softfp option now ? An emulator may not show the exact same behaviour as the actual hardware, which might explain the exit without an accompanying segfault. |
I figured this out. I was mixing up hard and soft floating point in the compiles. The issue went away after I cleaned and started from scratch. |
To be clear Android are already removed the armeabi-v7a-hard |
Hi,
I'm running into the following error: arm-linux-androideabi-gcc -mfloat-abi=hard ex.cpp -I/opt/arm-tools/include /opt/arm-tools/lib/libopenblas.a
arm-linux-androideabi/bin/ld: error: uses VFP register arguments, output does not
ex.cpp is a simple example taken from the web:
include <cblas.h>
include <stdio.h>
int main()
{
int i=0;
double A[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};
double B[6] = {1.0,2.0,1.0,-3.0,4.0,-1.0};
double C[9] = {.5,.5,.5,.5,.5,.5,.5,.5,.5};
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans,3,3,2,1,A, 3, B, 3,2,C,3);
for(i=0; i<9; i++)
printf("%lf ", C[i]);
printf("\n");
return 0;
}
I compiled the android toolchain following instructions here: http://developer.android.com/ndk/guides/standalone_toolchain.html
make-standalone-toolchain.sh --arch=arm --platform=android-21 --install-dir=/tmp/my-android-toolchain
I compiled OpenBlas following instructions here: https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android
make HOSTCC=gcc CC=arm-linux-androideabi-gcc NO_LAPACK=1 TARGET=ARMV7
I have noticed that this error goes away when I edit Makefile.arm, and replace -mfloat-abi=hard with -mfloat-abi=soft (had to do this for building and linking ex.cpp as well).
Reading the ABI compatibility section of the standalone toolchain page:
If you want to target the armeabi-v7a ABI, you must set the following flags:
CFLAGS= -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16
I think that while I've built ex.cpp, the binary will be slower than if it was build to use the FPU. Could someone help me figure out how to build this properly?
Thanks,
Kevin
The text was updated successfully, but these errors were encountered: