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

Cannot compile openblas 0.3.28 on macOS 15 with clang 16 #4888

Closed
fxcoudert opened this issue Sep 2, 2024 · 6 comments
Closed

Cannot compile openblas 0.3.28 on macOS 15 with clang 16 #4888

fxcoudert opened this issue Sep 2, 2024 · 6 comments
Labels

Comments

@fxcoudert
Copy link

Testing the beta macOS / clang combination (soon to be released) for Homebrew, and failing to compile openblas. I've tried to debug it myself, but the makefile-within-a-makefile build system is making my head hurt. Please give me a bit of help.

==> make CC=gcc-14 FC=gfortran libs netlib shared
clang: error: no input files
clang: error: no input files
make: *** [getarch] Error 2
Makefile.system:1588: Makefile.: No such file or directory
make: *** No rule to make target `Makefile.'.  Stop.

So the Makefile. error comes from ARCH apparently being set empty. I don't know why, and trying to pass ARCH=arm64 as command-line argument does not help either. Also, with the -d option:

fx@mini-m2 OpenBLAS-0.3.28 % make CC=gcc-14 FC=gfortran getarch -d
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
Reading makefiles...
Reading makefile `Makefile'...
Reading makefile `Makefile.system' (search path) (no ~ expansion)...
Reading makefile `Makefile.rule' (search path) (no ~ expansion)...
clang: error: no input files
clang: error: no input files
make: *** [getarch] Error 2
Reading makefile `Makefile.conf' (search path) (don't care) (no ~ expansion)...
Reading makefile `Makefile.' (search path) (no ~ expansion)...
Makefile.system:1588: Makefile.: No such file or directory

I don't even understand where it's calling clang from, since CC is set to something else.

@fxcoudert
Copy link
Author

Probably should have mentioned that the environment contains:

    MACOSX_DEPLOYMENT_TARGET = 15
    DYNAMIC_ARCH = 1
    USE_OPENMP = 1
    NUM_THREADS = 56
    TARGET = VORTEX
    NO_SVE = 1

@martin-frbg
Copy link
Collaborator

What does gcc-14 -v return on that system, and same for gfortran -v ? In some setups, the clang installation seems to come with softlinks or aliases to impersonate gcc... also you'll want to make sure that both gcc and gfortran are the same version.
In addition, there appears to be some confusion about what architecture this is - apparently you want to tell the build that it is arm64, but the installed version of make states that it is a 32bit x86 binary - what does uname -m tell ?
My gut feeling is that this is a misconfigured/misbehaving system and the errors arise already in the c_check script

@fxcoudert
Copy link
Author

fxcoudert commented Sep 2, 2024

[fx@mini-m2:~] % gcc-14  -v               
Using built-in specs.
COLLECT_GCC=gcc-14
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/14.2.0/bin/../libexec/gcc/aarch64-apple-darwin24/14/lto-wrapper
Target: aarch64-apple-darwin24
Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran,m2 --program-suffix=-14 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 14.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin24 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (Homebrew GCC 14.2.0) 
[fx@mini-m2:~] % gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/14.2.0/bin/../libexec/gcc/aarch64-apple-darwin24/14/lto-wrapper
Target: aarch64-apple-darwin24
Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/current --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran,m2 --program-suffix=-14 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 14.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --with-system-zlib --build=aarch64-apple-darwin24 --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.2.0 (Homebrew GCC 14.2.0) 
[fx@mini-m2:~] % uname -m
arm64

Apple's make is lying, for some reason. But the exact same setup works for macOS 12 and 13 and 14. And I can reproduce with GNU make.

How do I run c_check alone?

@martin-frbg
Copy link
Collaborator

./c_check a b gcc-14 (you can also append any options such as TARGET) - "a" becomes the first part of Makefile.conf, "b" of config.h
Interesting to see that gcc-14 and gfortran appear to be the real thing on your system - I do not think there is any point in the build system - whether around Makefile.prebuild where c_check/f_check get called, or in general) where clang could be called directly

@fxcoudert
Copy link
Author

OK, found it. An obscure bug in the new Apple linker :( which for some reason, even when called as as, identifies as clang.

[fx@mini-m2:/tmp] 2 % cat a.c  
int main (void) { return 0; }
[fx@mini-m2:/tmp] % gcc-14 a.c      
[fx@mini-m2:/tmp] % gcc-14 a.c -pipe
clang: error: no input files

Somehow it's not accepting stdin anymore:

[fx@mini-m2:/tmp] % as -arch arm64 toto.s -o toto.o
[fx@mini-m2:/tmp] % cat toto.s | as -arch arm64 -o toto.o
clang: error: no input files

So not an openblas issue. Sorry about the noise, it was a tricky one.

@fxcoudert
Copy link
Author

I have reported this to Apple as FB15021557. A copy of the report content can be found at iains/gcc-darwin-arm64#136

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

No branches or pull requests

2 participants