When building OpenBLAS on macOS with Ninja as the generator the build will fail due to the response file workaround in CMakeLists.txt. This is because Ninja doesn't generate the same .rsp response files that a Makefile generated by CMake would. This then has two consequences:
- A warning is generated during build just before the
libopenblas.a is generated:
cat: .../build/Release/CMakeFiles/openblas_static.dir/objects*.rsp: No such file or directory
ar: creating archive libopenblas.a
-
The libopenblas.a (and also the libopenblas.0.3.dylib) don't contain any code except for xerbla_.
-
Then the build fails because the tests that are built can't find the symbols of the actual functions of OpenBLAS:
Undefined symbols for architecture arm64:
"_caxpby_", referenced from:
___ctest_axpby_caxpby_inc_0_run in test_axpby.c.o
___ctest_axpby_caxpby_inc_1_run in test_axpby.c.o
___ctest_axpby_caxpby_inc_2_run in test_axpby.c.o
"_caxpy_", referenced from:
___ctest_axpy_caxpy_inc_0_run in test_axpy.c.o
___ctest_axpy_caxpy_incx_0_run in test_axpy.c.o
"_cgemv_", referenced from:
___ctest_cgemv_0_nan_inf_run in test_gemv.c.o
___ctest_cgemv_0_nan_inf_incy_2_run in test_gemv.c.o
___ctest_cgemv_0_2_nan_1_inf_1_run in test_gemv.c.o
___ctest_cgemv_0_2_nan_1_inf_1_incy_2_run in test_gemv.c.o
___ctest_cgemv_2_0_nan_1_inf_1_run in test_gemv.c.o
___ctest_cgemv_2_0_nan_1_inf_1_incy_2_run in test_gemv.c.o
[...]
With Ninja the workaround that is present in the CMakeLists.txt is not actually required, because Ninja always uses response files anyway (but uses temporary files it removes again, so there will never be a .rsp file in a build folder).
I therefore suggest to replace:
in CMakeLists.txt (around line 310) with
if(APPLE AND "${CMAKE_GENERATOR}" MATCHES ".*Makefiles")
That will still keep the workaround in-place when make is used, but allows Ninja to just work out of the box.
When building OpenBLAS on macOS with
Ninjaas the generator the build will fail due to the response file workaround inCMakeLists.txt. This is because Ninja doesn't generate the same.rspresponse files that aMakefilegenerated by CMake would. This then has two consequences:libopenblas.ais generated:The
libopenblas.a(and also thelibopenblas.0.3.dylib) don't contain any code except forxerbla_.Then the build fails because the tests that are built can't find the symbols of the actual functions of OpenBLAS:
With Ninja the workaround that is present in the
CMakeLists.txtis not actually required, because Ninja always uses response files anyway (but uses temporary files it removes again, so there will never be a.rspfile in a build folder).I therefore suggest to replace:
in
CMakeLists.txt(around line 310) withThat will still keep the workaround in-place when
makeis used, but allows Ninja to just work out of the box.