OpenMathLib / OpenBLAS

OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
http://www.openblas.net
BSD 3-Clause "New" or "Revised" License
6.4k stars 1.5k forks source link

build OpenBLAS for Android-x86_64 failed #3446

Closed leleliu008 closed 3 years ago

leleliu008 commented 3 years ago

https://github.com/xianyi/OpenBLAS/archive/v0.3.18.tar.gz

android-ndk 23.0.7599858

error log:

make -w -j6 OSNAME=Android ARCH=x86_64 TARGET=ATOM HOSTCC=/data/data/com.termux/files/usr/bin/cc ONLY_CBLAS=1 ARM_SOFTFP_ABI=1 CC=x86_64-linux-android21-clang AS=x86_64-linux-android-as AR=llvm-ar
make: Entering directory '/data/data/com.termux/files/usr/tmp/tmp.sZAqS1WN2a' 
clang-13: error: the clang compiler does not support '-march=native'
clang-13: error: the clang compiler does not support '-march=native'
clang-13: error: the clang compiler does not support '-march=native'    
make: *** [Makefile.prebuild:70: getarch] Error 1                       
Makefile.system:267: Makefile.conf: No such file or directory
make: *** No rule to make target 'Makefile.conf'.  Stop.

Makefile.system L188-L193

# On x86_64 build getarch with march=native unless the compiler is PGI. This is required to detect AVX512 support in getarch.
ifeq ($(HOSTARCH), x86_64)
ifeq ($(findstring pgcc,$(HOSTCC))$(findstring nvc,$(HOSTCC)),)
GETARCH_FLAGS += -march=native
endif
endif
martin-frbg commented 3 years ago

Thanks. Strange, I do not see this mentioned in their release notes. Have not installed clang-13 yet...

leleliu008 commented 3 years ago

lang13 is the host cc, not Android ndk cc.

leleliu008 commented 3 years ago
# If ARCH is not set, we use the host system's architecture for getarch compile options.                   
ifndef ARCH
        HOSTARCH := $(shell uname -m)
else
        HOSTARCH = $(ARCH)
endif

I think this logic is not correct. it should be changed to folloing:

HOSTARCH := $(shell uname -m)
martin-frbg commented 3 years ago

clang13 is the host cc, not Android ndk cc.

Yes, certainly. "getarch" is always compiled to run on the host, as it is also needed to provide the cpu parameters when a specific TARGET was given on the command line.

I think this logic is not correct. it should be changed to folloing:

this was introduced to support compiling for 32bit on arm64 , maybe it is overly complicated but I do not think it is actually wrong ?

leleliu008 commented 3 years ago

my host arch is aarch64

https://github.com/status-im/nimbus-eth2/issues/2758

martin-frbg commented 3 years ago

Oh. I did not expect that. Then setting HOSTARCH from ARCH would indeed be a problem (and maybe it was a coincidence that it did not break the arm/arm64 crossbuild, as the arm64 host may have been able to support 32bit binaries...). I guess I may have left that HOSTARCH=ARCH branch just to keep some compatibility with the previous version that was just using ARCH for everything. (Did not expect to make it bug-compatible though) So that would appear to be the actual cause, as the arm clang is known (if not documented) to not support "-march=native"