Skip to content
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

errors when build openblas for android-24 with clang #1513

Closed
xingjinglu opened this issue Apr 9, 2018 · 10 comments
Closed

errors when build openblas for android-24 with clang #1513

xingjinglu opened this issue Apr 9, 2018 · 10 comments

Comments

@xingjinglu
Copy link

xingjinglu commented Apr 9, 2018

I do as the instruction said, and it can generate the static library, but it failed for building so files in the directory of exports. The error messages are given as follow:

make[1]: Entering directory `~/software/OpenBLAS/exports'
make[1]: warning: -jN forced in submake: disabling jobserver mode.   
clang -target aarch64-linux-android --sysroot ~/software/android-ndk-r14b/platforms/android-24/arch-arm64 -gcc-toolchain ~/software/android-ndk-r14b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/ -O2 -DMAX_STACK_ALLOC=2048 -Wall -DF_INTERFACE_GFORT -fPIC -DNO_LAPACK -DNO_LAPACKE -DSMP_SERVER -DNO_WARMUP -DMAX_CPU_NUMBER=40 -march=armv8-a -DASMNAME= -DASMFNAME=_ -DNAME=_ -DCNAME= -DCHAR_NAME=\"_\" -DCHAR_CNAME=\"\" -DNO_AFFINITY -I.. -L~/software/android-ndk-r14b/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x
clang: error: no input files
make[1]: *** [../libopenblas_armv8p-r0.3.0.dev.so] Error 1
make[1]: Leaving directory `~/software/OpenBLAS/exports'
make: *** [shared] Error 2

PS: I tried both the git-develop version and the 0.2.20 release version, they had the same build errors.

@brada4
Copy link
Contributor

brada4 commented Apr 9, 2018

What command line do you pass to make/cmake?
Can you produce full make/cmake output?
Particular command line has no input file specified indeed, there should be a real mistake (like warning) preceding it.

@xingjinglu
Copy link
Author

xingjinglu commented Apr 9, 2018

The whole command are as below, I did it as the instructions on the website:

https://github.com/xianyi/OpenBLAS/wiki/How-to-build-OpenBLAS-for-Android#build-armv8-with-clang

# Set path to ndk-bundle
export NDK_BUNDLE_DIR=/home/usr/software/android-ndk-r14b

# Export PATH to contain directories of clang and aarch64-linux-android-*
# utilities
export PATH=${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/:${NDK_BUNDLE_DIR}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH

# Setup LDFLAGS so that loader can find libgcc and pass -lm for sqrt
export LDFLAGS="-L${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/lib/gcc/aarch64-linux-android/4.9.x
-lm"

# Setup the clang cross compile options
export CLANG_FLAGS="-target aarch64-linux-android --sysroot ${NDK_BUNDLE_DIR}/platforms/android-24/arch-arm64 -gcc-toolchain ${NDK_BUNDLE_DIR}/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/"

# Compile
make TARGET=ARMV8  ONLY_CBLAS=1 AR=ar CC="aarch64-linux-android-gcc ${CLANG_FLAGS}" HOSTCC=gcc NOFORTRAN=1

@brada4
Copy link
Contributor

brada4 commented Apr 9, 2018

Can you try adding FC=FAKE
It may find native gfortran in $PATH for no good.

@martin-frbg
Copy link
Collaborator

I do not think it would try to find a fortran compiler when NOFORTRAN=1 is set.
However I wonder if you have perl installed, which is still required for the tool that prepares the object list for the shared library.

@xingjinglu
Copy link
Author

xingjinglu commented Apr 10, 2018

@martin-frbg yes, I have perl installed.

perl --version

This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 29 registered patches, see perl -V for more detail)

Copyright 1987-2012, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

@xingjinglu
Copy link
Author

@brada4 It worked now when add FC=FAKE.
But I think the option( NOFORTRAN=1 ) will make it not look for FORTRAN compiler, so it is a little weird.

@brada4
Copy link
Contributor

brada4 commented Apr 10, 2018

I silently stumbled on that issue long ago without digging the cause,
Actual intended options are in Makefile.rule
NO_LAPACK would disable fortran library parts but still try fortran tests with FC , with your option absent FC seems only working one (though will be much more welcoming that your option works)

@martin-frbg
Copy link
Collaborator

martin-frbg commented Apr 10, 2018

I cannot reproduce this problem when using a standalone toolchain, my build log starts with "detecting fortran compiler failed" (despite gfortran being available in the host) when NOFORTRAN=1 is given.
(Note that when ONLY_CBLAS is set, the detection of the fortran compiler through f_check is skipped in Makefile.prebuild). Maybe you have FC preset in your environment for some reason ?
I do find the wiki instructions confused and confusing however as the detailed instructions in the clang part use path names from the unmodified NDK (which would lead to "stdio.h not found" and similar if used verbatim).

@martin-frbg
Copy link
Collaborator

Still works for me even when I set FC=/usr/bin/gfortran, and I do not see any loophole (except the potential trap that most NO_SOMETHING options have an underscore while NOFORTRAN does not)

@xingjinglu
Copy link
Author

@martin-frbg I will try it some time later to check if I can reproduce the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants