openblas: add patches to build with clang (#39138)

This commit is contained in:
Aiden Grossman 2023-12-19 08:22:29 -08:00 committed by GitHub
parent aa350a4ed1
commit 3f063153f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 0 deletions

View File

@ -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)

View File

@ -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

View File

@ -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",