Skip to content

Issue compiling OpenBLAS #1208

Closed
Closed

Description

Hi,

I am running into an issue trying to compile the OpenBLAS as part of compiling Kaldi for Android. I followed all the instructions on this blog(http://jcsilva.github.io/2017/03/18/compile-kaldi-android/ ) until the following where I am stuck:

make TARGET=ARMV7 HOSTCC=gcc CC=arm-linux-androideabi-gcc NOFORTRAN=1 NUM_THREADS=32 libs

This is the error I am getting when trying to run the above command:

C Compiler (arm-linux-androideabi-gcc) is something wrong.
1 at ./c_check line 28.
make: *** [config.h] Error 2
Makefile.system:165: Makefile.conf: No such file or directory
Makefile.system:912: Makefile.: No such file or directory
make: *** No rule to make target `Makefile.'. Stop.

I got the latest branch of OpenBLAS.

I did set the PATH to the android tool chain correctly.

I am running out of options.

Any help is greatly appreciated.

Thanks in advance.

Activity

  1. martin-frbg commented on Jun 19, 2017

    @martin-frbg
    Collaborator

    Still looks as if the PATH to the android toolchain is not set correctly (or the toolchain is incomplete).
    At that point in c_check it tries to run the command arm-linux-androideabi-gcc -E ctest.c - you could try entering this on a command line to see what error message you get.

  2. brada4 commented on Jun 19, 2017

    @brada4
    Contributor

    Unlikely there will be 32-core 32bit android any time soon. What is your NDK vrsion? Is it recent clang-based?

  3. brada4 commented on Jun 19, 2017

    @brada4
    Contributor

    But close this issue in the meantime, Android NDK is not OpenBLAS component.

  4. brada4 commented on Jun 19, 2017

    @brada4
    Contributor

    You need to run 'make clean' before building with different parameters.
    You can set FC=NoThing or something similarily fake to disable all fortran/lapack. It seems that build system picks gfortran present on build host which is obvioulsy x86 and will not suffice for lapack in your library.

  5. brada4 commented on Jun 19, 2017

    @brada4
    Contributor

    I dont see how that could emit armeabi binaries.

  6. brada4 commented on Jun 19, 2017

    @brada4
    Contributor

    -lgfortran comes from previous failed build. You sort of try to build without fortran already, I just suggested other option to disable fortran and lapack.

  7. brada4 commented on Jun 21, 2017

    @brada4
    Contributor

    If you mix up system compilers with cross compilers they dont produce valid executable modules.
    Can you fix your compilers before trying a new build?

  8. martin-frbg commented on Jun 21, 2017

    @martin-frbg
    Collaborator

    Seems there is something wrong with your Android toolchain setup, the linker appears to be finding the local x86 libraries of the build host instead of the Android ones provided by the NDK. And the fact that it tries to link with libgfortran (and its dependency libquadmath) at all suggests that you may have object files around from a previous build attempt where you forgot to specifiy NOFORTRAN=1. Best review your NDK installation and then do a make clean followed by make TARGET=ARMV7 HOSTCC=gcc CC=arm-linux-androideabi-gcc NOFORTRAN=1 NUM_THREADS=32 (note no "libs" or "shared" at the end of the command line, this should do the complete build in one go).

  9. brada4 commented on Jun 22, 2017

    @brada4
    Contributor

    I dont know why your NDK picks files from system library path. Do you set something like LD_LIB_PATH before failed builds?

  10. martin-frbg commented on Jun 22, 2017

    @martin-frbg
    Collaborator

    Maybe you need to set ANDROID_NDK_PATH or NDK_ROOT so that it can find all parts of itself ?
    A build script was posted as part of #963 (and I have been meaning to add it but never got around to doing that it seems), perhaps it helps ?

  11. xianyi commented on Jun 23, 2017

    @xianyi
    Collaborator

    I have compiled Android static lib and shared library on My Mac.

    For example, softfp ABI.

    make TARGET=ARMV7 HOSTCC=clang CC=arm-linux-androideabi-gcc NO_LAPACK=1 ARM_SOFTFP_ABI=1
    
    make TARGET=ARMV7 HOSTCC=clang CC=arm-linux-androideabi-gcc NO_LAPACK=1 ARM_SOFTFP_ABI=1 shared
    
    
    make TARGET=ARMV7 HOSTCC=clang CC=arm-linux-androideabi-gcc NO_LAPACK=1 ARM_SOFTFP_ABI=1 PREFIX=/to/your/path install
    

    In first step, you may meet some errors in building test. It is OK.

    The second step is building shared library.

  12. brada4 commented on Jun 29, 2017

    @brada4
    Contributor

    Compile with older NDK?

  13. lixiaohang commented on Apr 23, 2019

    @lixiaohang

    Hi ,

    Can someone please help? I am stuck here unable to proceed further. Basically I am not able to successfully compile the shared library libopenblas_armv7p-r0.2.20.dev.so.

    Basically this is my first step which finishes without any errors:

    make TARGET=ARMV7 HOSTCC=gcc CC=arm-linux-androideabi-gcc NOFORTRAN=1 NUM_THREADS=32 libs

    Since it did not build the .so file, I then did the following which fails(the .so file is created though..but it throws the same stderr error when used in another native project)

    make TARGET=ARMV7 HOSTCC=gcc CC=arm-linux-androideabi-gcc NOFORTRAN=1 NUM_THREADS=32 shared

    I am pasting the output from the make command. May be the warnings might throw some light(please note that the last warning about libc). Please let me know if there are issues in my configuration(i.e what is the incompatibility here??). Thanks in advance.

    make[1]: Entering directory `/AS/OpenBLAS/exports'
    perl ./gensymbol linktest arm _ 0 0 1 1 0 0 "" "" 1 > linktest.c
    arm-linux-androideabi-gcc -O2 -DMAX_STACK_ALLOC=2048 -Wall -DF_INTERFACE_GFORT -fPIC -DNO_LAPACK -DNO_LAPACKE -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=32 -marm -mfpu=neon -mfloat-abi=hard -march=armv7-a -Wl,--no-warn-mismatch -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME="" -DCHAR_CNAME="" -DNO_AFFINITY -I.. -shared -o ../libopenblas_armv7p-r0.2.20.dev.so -Wl,--whole-archive ../libopenblas_armv7p-r0.2.20.dev.a -Wl,--no-whole-archive -Wl,-soname,libopenblas.so arm-linux-androideabi-gcc -O2 -DMAX_STACK_ALLOC=2048 -Wall -DF_INTERFACE_GFORT -fPIC -DNO_LAPACK -DNO_LAPACKE -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=32 -marm -mfpu=neon -mfloat-abi=hard -march=armv7-a -Wl,--no-warn-mismatch -DASMNAME= -DASMFNAME= -DNAME=_ -DCNAME= -DCHAR_NAME="_" -DCHAR_CNAME="" -DNO_AFFINITY -I.. -w -o linktest linktest.c ../libopenblas_armv7p-r0.2.20.dev.so -L/usr/lib/gcc/x86_64-linux-gnu/4.9 -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.9/../../.. -lgfortran -lm -lquadmath -lm -lc && echo OK.

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgfortran.so while searching for gfortran

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lgfortran

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libm.so while searching for m

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so while searching for m

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libquadmath.so while searching for quadmath

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lquadmath

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libm.so while searching for m

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libm.so while searching for m

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.so while searching for c

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libdl.so while searching for dl

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libdl.so while searching for dl

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so while searching for c

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/libc.so while searching for c

    /AS/my-android-toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/x86_64-linux-gnu/libc.so while searching for c
    ../libopenblas_armv7p-r0.2.20.dev.so: error: undefined reference to 'stderr'
    collect2: error: ld returned 1 exit status
    make[1]: *** [../libopenblas_armv7p-r0.2.20.dev.so] Error 1
    make[1]: Leaving directory `/AS/OpenBLAS/exports'
    Makefile:85: recipe for target 'shared' failed
    make: *** [shared] Error 2

    Hi :
    How did you solver this Problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions