OpenBLAS: Make error if gfortran installed on Apple M1 machine

Numpy needs OpenBLAS for building.

make

gfortran -O2 -Wall -frecursive -fno-optimize-sibling-calls  -march=armv8-a  -o sblat1 sblat1.o ../libopenblas_armv8p-r0.3.12.dev.a -lpthread -lgfortran -lpthread -lgfortran -L/usr/local/lib  -lto_library -lSystem  /Library/Developer/CommandLineTools/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a 
ld: library not found for -lm
collect2: error: ld returned 1 exit status
make[1]: *** [sblat1] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [tests] Error 2

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 32 (5 by maintainers)

Commits related to this issue

Most upvoted comments

It looks like gfortran was compiled with /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk and gfortran saves this location into its binary. You have /Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk which becomes a problem. A workaround is to do export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk. This is not an issue with openblas, but rather gfortran.