Bug#1107590: openblas FTCBFS: multiple reasons

Helmut Grohne helmut at subdivi.de
Tue Jun 10 10:56:16 BST 2025


Source: openblas
Version: 0.3.29+ds-3
Tags: patch
User: debian-cross at lists.debian.org
Usertags: cross-satisfiability ftcbfs

openblas fails to cross build from source for several reasons. The
immediate problem is that gfortran as a build dependency cannot be
installed. "gfortran" refers to the native compiler for the host
architecture and if it were installable it could not be run. Instead,
openblas should build depend on "gfortran-for-host". Doing so comes with
a twist though. You cannot just run "gfortran" then. A triplet-prefixed
variant must be used (even for native builds). To comply with this
limitation, a suitable FC variable needs to be passed to the build
system. A suitable value can be obtained from dpkg's buildtools.mk.
While at it, I suggest also setting CC to make the build system honour
the builders choice. For actually cross compiling, the build system
needs to be told via CROSS=1 and it also needs a HOSTCC. And with that
in place, cross building openblas seems to just work. I'm attaching a
patch meant for forky for your convenience.

Helmut
-------------- next part --------------
diff --minimal -Nru openblas-0.3.29+ds/debian/changelog openblas-0.3.29+ds/debian/changelog
--- openblas-0.3.29+ds/debian/changelog	2025-03-10 19:55:28.000000000 +0100
+++ openblas-0.3.29+ds/debian/changelog	2025-05-31 19:51:06.000000000 +0200
@@ -1,3 +1,12 @@
+openblas (0.3.29+ds-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: (Closes: #-1)
+    * Build-Depend on gfortran-for-host.
+    * Set more MAKE_OPTIONS to forward the toolchain.
+
+ -- Helmut Grohne <helmut at subdivi.de>  Sat, 31 May 2025 19:51:06 +0200
+
 openblas (0.3.29+ds-3) unstable; urgency=medium
 
   * Cherry-pick upstream PR#5170 for thread safety of pthread build.
diff --minimal -Nru openblas-0.3.29+ds/debian/control openblas-0.3.29+ds/debian/control
--- openblas-0.3.29+ds/debian/control	2025-01-28 02:08:14.000000000 +0100
+++ openblas-0.3.29+ds/debian/control	2025-05-31 19:47:49.000000000 +0200
@@ -6,7 +6,7 @@
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
                debhelper (>= 12.8~),
-               gfortran,
+               gfortran-for-host,
                liblapack-dev (>= 3.12),
                liblapack64-dev (>= 3.12) [amd64 arm64 ppc64el ppc64 mips64el riscv64 sparc64 s390x loong64],
 Standards-Version: 4.7.0
diff --minimal -Nru openblas-0.3.29+ds/debian/rules openblas-0.3.29+ds/debian/rules
--- openblas-0.3.29+ds/debian/rules	2025-03-10 19:55:23.000000000 +0100
+++ openblas-0.3.29+ds/debian/rules	2025-05-31 19:51:06.000000000 +0200
@@ -4,12 +4,18 @@
 export DEB_LDFLAGS_MAINT_STRIP := "-Wl,-Bsymbolic-functions"
 
 include /usr/share/dpkg/buildflags.mk
+include /usr/share/dpkg/buildtools.mk
 include /usr/share/dpkg/pkg-info.mk
 SOVER := 0
 SRCS := $(filter-out debian $(FLAVORS), $(wildcard ./*))
 
 MAKE_OPTIONS := NO_LAPACKE=1 NO_AFFINITY=1 NO_WARMUP=1 CFLAGS="$(CPPFLAGS) $(CFLAGS)" FFLAGS="$(FFLAGS)"
 
+MAKE_OPTIONS += CC='$(CC)' FC='$(FC)'
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+MAKE_OPTIONS += CROSS=1 HOSTCC='$(CC_FOR_BUILD)'
+endif
+
 # Avoid having -O2 automatically added (especially for DEB_BUILD_OPTIONS=noopt)
 MAKE_OPTIONS += COMMON_OPT=
 


More information about the debian-science-maintainers mailing list