summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/openblas/openblas_append_lflags.patch26
-rw-r--r--var/spack/repos/builtin/packages/openblas/openblas_libomp_fork.patch13
-rw-r--r--var/spack/repos/builtin/packages/openblas/package.py11
3 files changed, 50 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/openblas/openblas_append_lflags.patch b/var/spack/repos/builtin/packages/openblas/openblas_append_lflags.patch
new file mode 100644
index 0000000000..4ae1427c33
--- /dev/null
+++ b/var/spack/repos/builtin/packages/openblas/openblas_append_lflags.patch
@@ -0,0 +1,26 @@
+diff --git a/ctest/Makefile b/ctest/Makefile
+index 0fb2450d28..9e85d23b96 100644
+--- a/ctest/Makefile
++++ b/ctest/Makefile
+@@ -208,7 +208,7 @@ FLDFLAGS = $(FFLAGS:-fPIC=) $(LDFLAGS)
+ ifeq ($(USE_OPENMP), 1)
+ ifeq ($(F_COMPILER), GFORTRAN)
+ ifeq ($(C_COMPILER), CLANG)
+-CEXTRALIB = -lomp
++CEXTRALIB += -lomp
+ endif
+ endif
+ ifeq ($(F_COMPILER), NAG)
+diff --git a/test/Makefile b/test/Makefile
+index 923f1537c2..46a7b11583 100644
+--- a/test/Makefile
++++ b/test/Makefile
+@@ -265,7 +265,7 @@ FLDFLAGS = $(FFLAGS:-fPIC=) $(LDFLAGS)
+ ifeq ($(USE_OPENMP), 1)
+ ifeq ($(F_COMPILER), GFORTRAN)
+ ifeq ($(C_COMPILER), CLANG)
+-CEXTRALIB = -lomp
++CEXTRALIB += -lomp
+ endif
+ endif
+ ifeq ($(F_COMPILER), NAG) \ No newline at end of file
diff --git a/var/spack/repos/builtin/packages/openblas/openblas_libomp_fork.patch b/var/spack/repos/builtin/packages/openblas/openblas_libomp_fork.patch
new file mode 100644
index 0000000000..b1f94da72c
--- /dev/null
+++ b/var/spack/repos/builtin/packages/openblas/openblas_libomp_fork.patch
@@ -0,0 +1,13 @@
+diff --git a/utest/Makefile b/utest/Makefile
+index f99035440c..eab9046574 100644
+--- a/utest/Makefile
++++ b/utest/Makefile
+@@ -29,8 +29,11 @@ ifeq ($(OSNAME), $(filter $(OSNAME),Linux CYGWIN_NT))
+ ifneq ($(USE_OPENMP), 1)
+ OBJS += test_fork.o
+ endif
++# LLVM's libomp throws an assertion when running the post fork test
++ifneq ($(C_COMPILER), CLANG)
+ OBJS += test_post_fork.o
+ endif
++endif
diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py
index ea9f82bf26..866e571c47 100644
--- a/var/spack/repos/builtin/packages/openblas/package.py
+++ b/var/spack/repos/builtin/packages/openblas/package.py
@@ -195,6 +195,17 @@ class Openblas(CMakePackage, MakefilePackage):
when="@0.3.21 %gcc@:9",
)
+ # Some installations of clang and libomp have non-standard locations for
+ # libomp. OpenBLAS adds the correct linker flags but overwrites the
+ # variables in a couple places, causing link-time failures.
+ patch("openblas_append_lflags.patch", when="@:0.3.23 threads=openmp")
+
+ # Some builds of libomp on certain systems cause test failures related to
+ # forking, so disable the specific test that's failing. This is currently
+ # an open issue upstream:
+ # https://github.com/llvm/llvm-project/issues/63908
+ patch("openblas_libomp_fork.patch", when="%clang@15:")
+
# Fix build on A64FX for OpenBLAS v0.3.24
patch(
"https://github.com/OpenMathLib/OpenBLAS/commit/90231bfc4e4afc51f67c248328fbef0cecdbd2c2.patch?full_index=1",