OpenBLAS: gfortran 11 ARM-darwin (Apple M1) build failure

We are seeing an openblas build failure (in Homebrew: https://github.com/Homebrew/homebrew-core/pull/74843#issuecomment-832845395) with the latest gcc/gfortran 11.1 port to Apple M1 (ARM-darwin). The failure is:

2021-05-04T22:06:45.3605470Z ranlib ../../../libopenblasp-r0.3.15.a
2021-05-04T22:06:45.3606170Z make[1]: warning: -jN forced in submake: disabling jobserver mode.
2021-05-04T22:06:45.3606690Z perl ./gensymbol osx arm64 _ 0 0  0 0 0 0 "" "" 1 0 1 1 1 1 > osx.def
2021-05-04T22:06:45.3611100Z gfortran -O2 -Wall -frecursive -fno-optimize-sibling-calls -fopenmp -fPIC -march=armv8.3-a  -all_load -headerpad_max_install_names -install_name "/private/tmp/openblas-20210504-81004-e68xc6/OpenBLAS-0.3.15/exports/../libopenblas.0.dylib" -dynamiclib -o ../libopenblasp-r0.3.15.dylib ../libopenblasp-r0.3.15.a -Wl,-exported_symbols_list,osx.def  -L/opt/homebrew/Cellar/gcc/11.1.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0 -L/opt/homebrew/Cellar/gcc/11.1.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -Wl,-rpath,,loader_path -Wl,-rpath,/opt/homebrew/Cellar/gcc/11.1.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0 -Wl,-rpath,/opt/homebrew/Cellar/gcc/11.1.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -L/opt/homebrew/Cellar/gcc/11.1.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0 -L/opt/homebrew/Cellar/gcc/11.1.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../.. -Wl,-rpath,,loader_path -Wl,-rpath,/opt/homebrew/Cellar/gcc/11.1.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0 -Wl,-rpath,/opt/homebrew/Cellar/gcc/11.1.0/lib/gcc/11/gcc/aarch64-apple-darwin20/11.1.0/../../..  -lgfortran -lgomp -lm -lSystem -lgfortran -lgomp -lm -lSystem  
2021-05-04T22:06:45.3615250Z ld: file not found: loader_path
2021-05-04T22:06:45.3615640Z collect2: error: ld returned 1 exit status
2021-05-04T22:06:45.3616290Z make[1]: *** [libopenblasp-r0.3.15.dylib] Error 1
2021-05-04T22:06:45.3616750Z make: *** [shared] Error 2

The compiler appears otherwise functional, so I think it’s specific to OpenBLAS. The problem is the -Wl,-rpath,,loader_path argument that is passed (twice), and I do not understand where it comes from.

The compiler driver itself can, in some circumstances, pass -Wl,-rpath,@loader_path which is a valid option. But somehow it seems that this @ gets mangled into a , making the whole thing invalid.

I haven’t managed, however, to find where in OpenBLAS build machinery, this could be happening. Can someone point me in the right direction.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 21

Commits related to this issue

Most upvoted comments

Heh. So now I have the added superpower of halting compiler deployment ? Hopefully #3223 fixes it without new side effects. ( I realize now that it is basically the same as your proposal, just using a different character for the replacement - too busy with completely unrelated work yesterday)

Try setting MACOSX_DEPLOYMENT_TARGET=11.0 this is probably a bug in xcode

Has this been resolved? Seems to be getting similar error.

perl ./gensymbol osx arm64 _ 0 0  0 0 0 0 "" "" 1 0 1 1 1 1 > osx.def
gfortran -O2 -Wall -frecursive -fno-optimize-sibling-calls -fPIC -march=armv8-a  -all_load -headerpad_max_install_names -install_name "/Users/siddharthg/Github-dev/kaldi/tools/OpenBLAS/exports/../libopenblas.0.dylib" -dynamiclib -o ../libopenblas_armv8-r0.3.13.dylib ../libopenblas_armv8-r0.3.13.a -Wl,-exported_symbols_list,osx.def  -L/opt/homebrew/Cellar/gcc/11.3.0_2/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11 -L/opt/homebrew/Cellar/gcc/11.3.0_2/bin/../lib/gcc/11/gcc -L/opt/homebrew/Cellar/gcc/11.3.0_2/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11/../../.. -Wl,-rpath,,loader_path -Wl,-rpath,/opt/homebrew/Cellar/gcc/11.3.0_2/lib/gcc/11/gcc/aarch64-apple-darwin21/11 -Wl,-rpath,/opt/homebrew/Cellar/gcc/11.3.0_2/lib/gcc/11/gcc -Wl,-rpath,/opt/homebrew/Cellar/gcc/11.3.0_2/lib/gcc/11  -lgfortran -lemutls_w -lquadmath -lemutls_w -lSystem
ld: file not found: loader_path
collect2: error: ld returned 1 exit status
make[1]: *** [libopenblas_armv8-r0.3.13.dylib] Error 1
make: *** [shared] Error 2