Source: openmpi Version: 5.0.7-1 Tags: patch User: [email protected] Usertags: cross-satisfiability
openmpi cannot be cross built from source, because three of its Build-Depends are not installable. The sphinx-related dependencies are relatively easiy. sphinx really is needed for an arch-only build as it is used for generating manual pages. Hence, we cannot move them to B-D-I. Whilst sphinx can be used in architecture-dependent ways and therefore is not flagged Multi-Arch: foreign, that's not its most common use. As a result, sphinx-related dependencies often need to be annotated :native and that's also the case here. Nextup is the gfortran dependency. It is requesting a native compiler for the host architecture. If that were installable, you couldn't expect to be able to run it. What is needed here is gfortran-for-host, but it comes with a catch. Once you depend on it, you are no longer entitled to use the bare gfortran command. Instead, the toolchain must now be prefixed with the architecture (even for native builds). Fortunately, dpkg's buildtools.mk knows a suitable value (not being f77) and can export it as FC. And then we may satisfy cross build-depends. Please be aware that exporting triplet-prefixed build tools affects binary packages as OpenMPI embeds the compiler names in tons of files including headers and shared libraries. Having triplet-prefixed values there generally is beneficial, but keep in mind that this change does affect binary packages. Also note that this does not make openmpi cross buildable. It merely means that cross building can be attempted. OpenMPI has a lot of sizeof checks for Fortran that are not implemented using compiler bisection. Those readily fail. The typical workaround here is supplying cached values, but I don't think it scales well for Debian's openmpi package. Instead, implementing bisection at the upstream side would likely be more useful. In any case, I'm attaching a patch with the changes necessary to satisfy cross Build-Depends. It's meant for forky. Helmut
diff --minimal -Nru openmpi-5.0.7/debian/changelog openmpi-5.0.7/debian/changelog --- openmpi-5.0.7/debian/changelog 2025-02-17 14:09:46.000000000 +0100 +++ openmpi-5.0.7/debian/changelog 2025-06-10 11:43:09.000000000 +0200 @@ -1,3 +1,10 @@ +openmpi (5.0.7-1.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Make Build-Depends compatible with cross building. (Closes: #-1) + + -- Helmut Grohne <[email protected]> Tue, 10 Jun 2025 11:43:09 +0200 + openmpi (5.0.7-1) unstable; urgency=medium * New upstream release diff --minimal -Nru openmpi-5.0.7/debian/control openmpi-5.0.7/debian/control --- openmpi-5.0.7/debian/control 2025-02-17 14:09:46.000000000 +0100 +++ openmpi-5.0.7/debian/control 2025-06-10 11:43:09.000000000 +0200 @@ -12,7 +12,7 @@ libpmix-dev (>= 5.0.6-2), libucx-dev [amd64 arm64 ppc64el riscv64], zlib1g-dev, - gfortran, + gfortran-for-host, libhwloc-dev, pkgconf, libibverbs-dev (>= 1.1.7) [!hurd-any], @@ -20,8 +20,8 @@ libnuma-dev [!hurd-any], libpsm-infinipath1-dev [amd64], libpsm2-dev [amd64], - python3-sphinx-rtd-theme, - python3-recommonmark, + python3-sphinx-rtd-theme:native, + python3-recommonmark:native, default-jdk [!hurd-any !alpha !ppc64 !sparc64] <!nojava>, chrpath, flex diff --minimal -Nru openmpi-5.0.7/debian/rules openmpi-5.0.7/debian/rules --- openmpi-5.0.7/debian/rules 2025-02-17 14:09:46.000000000 +0100 +++ openmpi-5.0.7/debian/rules 2025-06-10 11:43:09.000000000 +0200 @@ -4,6 +4,8 @@ DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk +DPKG_EXPORT_BUILDTOOLS = 1 +include /usr/share/dpkg/buildtools.mk DESTDIR:=$(CURDIR)/debian/tmp/ BUILDDIR_FLANG=debian/build-flang @@ -51,11 +53,6 @@ FMODDIR:=/usr/lib/$(DEB_HOST_MULTIARCH)/fortran/$(GFORTRAN_MOD_VERSION) # arch-neutral version we can put in openmpi-common configs FMODDIR_STRING:="\${libdir}/fortran/$(GFORTRAN_MOD_VERSION)" -# FC set to f77 by default in make -# Read default compiler name unless FC is actually set -ifeq ($(FC),f77) - FC:=$(shell basename $(shell readlink /etc/alternatives/f95)) -endif # Drop '-g' flag with flang. Known failure with 2018122 version ifneq ($(filter flang,$(FC)),)

