commit:     a5db7347092cf06fa68e1f5cac62dabf0e3f204f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 14 13:28:01 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 14 13:28:01 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a5db7347

sci-libs/openblas: fix build issues

Fix build on some Arrow Lake CPUs and also w/o openmp or threads.

Closes: https://bugs.gentoo.org/964049
Closes: https://bugs.gentoo.org/969390
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/openblas-0.3.31-arrow-lake.patch         |  50 ++++++++++
 .../files/openblas-0.3.31-no-threads.patch         | 102 +++++++++++++++++++++
 sci-libs/openblas/openblas-0.3.31.ebuild           |   5 +
 3 files changed, 157 insertions(+)

diff --git a/sci-libs/openblas/files/openblas-0.3.31-arrow-lake.patch 
b/sci-libs/openblas/files/openblas-0.3.31-arrow-lake.patch
new file mode 100644
index 000000000000..16a024877215
--- /dev/null
+++ b/sci-libs/openblas/files/openblas-0.3.31-arrow-lake.patch
@@ -0,0 +1,50 @@
+https://bugs.gentoo.org/964049
+https://github.com/OpenMathLib/OpenBLAS/issues/5635
+https://github.com/OpenMathLib/OpenBLAS/pull/5636
+
+From 0ae18524cd536c82f456e0505734a68920f5612d Mon Sep 17 00:00:00 2001
+From: Martin Kroeker <[email protected]>
+Date: Thu, 5 Feb 2026 20:18:46 +0100
+Subject: [PATCH] Add Arrow Lake H/U
+
+---
+ cpuid_x86.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/cpuid_x86.c b/cpuid_x86.c
+index 13fc3605d0..2e2bb23b08 100644
+--- a/cpuid_x86.c
++++ b/cpuid_x86.c
+@@ -1563,6 +1563,7 @@ int get_cpuname(void){
+         break;
+       case 11: //family 6 exmodel 11
+         switch (model) {
++                case 5: // Arrow Lake H/U
+           case 7: // Raptor Lake
+           case 10:
+           case 15:
+@@ -1588,6 +1589,7 @@ int get_cpuname(void){
+             break;
+         case 15:
+         case 6: // Arrow Lake
++        case 5:
+           if(support_avx512())
+               return CPUTYPE_SAPPHIRERAPIDS;
+             if(support_avx2())
+@@ -2418,6 +2420,7 @@ int get_coretype(void){
+ 
+       case 11:
+       switch (model) {
++        case 5: // Arrow Lake H/U
+         case 7: // Raptor Lake
+           case 10:
+           case 15:
+@@ -2434,6 +2437,7 @@ int get_coretype(void){
+       }
+       case 12:
+       switch (model) {
++        case 5:
+         case 6: // Arrow Lake
+         if(support_amx_bf16())
+           return CORE_SAPPHIRERAPIDS;
+

diff --git a/sci-libs/openblas/files/openblas-0.3.31-no-threads.patch 
b/sci-libs/openblas/files/openblas-0.3.31-no-threads.patch
new file mode 100644
index 000000000000..705f3ebc5f59
--- /dev/null
+++ b/sci-libs/openblas/files/openblas-0.3.31-no-threads.patch
@@ -0,0 +1,102 @@
+https://bugs.gentoo.org/969390
+https://github.com/OpenMathLib/OpenBLAS/issues/5607
+https://github.com/OpenMathLib/OpenBLAS/pull/5615
+
+From 874243421298866d116e1e8bdbd7e0ed4e31e4f6 Mon Sep 17 00:00:00 2001
+From: Martin Kroeker <[email protected]>
+Date: Sun, 18 Jan 2026 19:55:40 +0100
+Subject: [PATCH 1/2] Include thread callback replacement hook in
+ singlethreaded builds as well
+
+---
+ driver/others/CMakeLists.txt | 2 +-
+ driver/others/Makefile       | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/driver/others/CMakeLists.txt b/driver/others/CMakeLists.txt
+index a07a0baf99..72abdc4ee4 100644
+--- a/driver/others/CMakeLists.txt
++++ b/driver/others/CMakeLists.txt
+@@ -27,7 +27,6 @@ if (USE_THREAD)
+     ${BLAS_SERVER}
+     divtable.c # TODO: Makefile has -UDOUBLE
+     blas_l1_thread.c
+-    blas_server_callback.c
+   )
+ 
+   if (NOT NO_AFFINITY)
+@@ -42,6 +41,7 @@ set(COMMON_SOURCES
+   openblas_env.c
+   openblas_get_num_procs.c
+   openblas_get_num_threads.c
++  blas_server_callback.c
+ )
+ 
+ # these need to have NAME/CNAME set, so use GenerateNamedObjects, but don't 
use standard name mangling
+diff --git a/driver/others/Makefile b/driver/others/Makefile
+index 719d617c45..fbd016e6b0 100644
+--- a/driver/others/Makefile
++++ b/driver/others/Makefile
+@@ -1,12 +1,12 @@
+ TOPDIR        = ../..
+ include ../../Makefile.system
+ 
+-COMMONOBJS     = memory.$(SUFFIX) xerbla.$(SUFFIX) c_abs.$(SUFFIX) 
z_abs.$(SUFFIX) openblas_set_num_threads.$(SUFFIX) 
openblas_get_num_threads.$(SUFFIX) openblas_get_num_procs.$(SUFFIX) 
openblas_get_config.$(SUFFIX) openblas_get_parallel.$(SUFFIX) 
openblas_error_handle.$(SUFFIX) openblas_env.$(SUFFIX)
++COMMONOBJS     = memory.$(SUFFIX) xerbla.$(SUFFIX) c_abs.$(SUFFIX) 
z_abs.$(SUFFIX) openblas_set_num_threads.$(SUFFIX) 
openblas_get_num_threads.$(SUFFIX) openblas_get_num_procs.$(SUFFIX) 
openblas_get_config.$(SUFFIX) openblas_get_parallel.$(SUFFIX) 
openblas_error_handle.$(SUFFIX) openblas_env.$(SUFFIX) 
blas_server_callback.$(SUFFIX)
+ 
+ #COMMONOBJS   += slamch.$(SUFFIX) slamc3.$(SUFFIX) dlamch.$(SUFFIX)  
dlamc3.$(SUFFIX)
+ 
+ ifdef SMP
+-COMMONOBJS    += blas_server.$(SUFFIX) divtable.$(SUFFIX) 
blasL1thread.$(SUFFIX) blas_server_callback.$(SUFFIX)
++COMMONOBJS    += blas_server.$(SUFFIX) divtable.$(SUFFIX) 
blasL1thread.$(SUFFIX)
+ ifneq ($(NO_AFFINITY), 1)
+ COMMONOBJS    += init.$(SUFFIX)
+ endif
+
+From 566e315f4f064e5c270e4401adfa3942368ba03a Mon Sep 17 00:00:00 2001
+From: Martin Kroeker <[email protected]>
+Date: Sun, 18 Jan 2026 19:59:49 +0100
+Subject: [PATCH 2/2] Make test_post_fork_async depend on LAPACK as it uses
+ getrf
+
+---
+ utest/CMakeLists.txt | 5 +++++
+ utest/Makefile       | 5 ++++-
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/utest/CMakeLists.txt b/utest/CMakeLists.txt
+index c73152d79a..69c8d0a413 100644
+--- a/utest/CMakeLists.txt
++++ b/utest/CMakeLists.txt
+@@ -101,9 +101,14 @@ if (NOT USE_OPENMP)
+ set(OpenBLAS_utest_src
+   ${OpenBLAS_utest_src}
+   test_fork.c
++  )
++if (NOT NO_LAPACK)
++set(OpenBLAS_utest_src
++  ${OpenBLAS_utest_src}
+   test_post_fork_async.c
+   )
+ endif()
++endif()
+ set(OpenBLAS_utest_src
+   ${OpenBLAS_utest_src}
+   test_post_fork.c
+diff --git a/utest/Makefile b/utest/Makefile
+index e92fb67dc1..c3bf7e706b 100644
+--- a/utest/Makefile
++++ b/utest/Makefile
+@@ -45,7 +45,10 @@ endif
+ # FIXME TBD if this works on OSX, SunOS, POWER and zarch
+ ifeq ($(OSNAME), $(filter $(OSNAME),Linux CYGWIN_NT))
+ ifneq ($(USE_OPENMP), 1)
+-OBJS += test_fork.o test_post_fork_async.o
++OBJS += test_fork.o
++ifneq ($(NO_LAPACK), 1)
++OBJS += test_post_fork_async.o
++endif
+ endif
+ OBJS += test_post_fork.o
+ endif
+

diff --git a/sci-libs/openblas/openblas-0.3.31.ebuild 
b/sci-libs/openblas/openblas-0.3.31.ebuild
index 3d60c157f2ea..a4be20c95f2a 100644
--- a/sci-libs/openblas/openblas-0.3.31.ebuild
+++ b/sci-libs/openblas/openblas-0.3.31.ebuild
@@ -20,6 +20,11 @@ RESTRICT="!cpudetection? ( bindist ) !test? ( test )"
 
 BDEPEND="virtual/pkgconfig"
 
+PATCHES=(
+       "${FILESDIR}"/${P}-no-threads.patch
+       "${FILESDIR}"/${P}-arrow-lake.patch
+)
+
 pkg_pretend() {
        [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
 

Reply via email to