Source: libtool
Version: 2.4.7-7
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: cross-satisfiability

libtool cannot be cross built from source, because its gfortran
dependency is not satisfiable. What is being requested here is a host
architecture fortran compiler running on the host architecture. As it
also depends on a C compiler (again for the host architecture) we arrive
at a conflict with the build architecture C compiler implied in
build-essential.

The matter is fairly old and dubbed "toolchain dependency cross
translation". After so many years, this has been solved in principle via
introducing -for-host packages to gcc. In essence, we now annotated
toolchain dependencies with a -for-build or -for-host suffix depending
what we use them for. So we just replace gfortran with
gfortran-for-host, right?

Unfortunately, no. When we pull a -for-host package, cross building will
work, because autotools prefixes host tools with a host triplet. Once
attempting a native build, autotools will not do so and thus failing to
find gfortran as gfortran-for-host only provides a triplet-prefixed name
for gfortran and autotools does not attempt to use it by that name. We
can fix this aspect by forcing a triplet-prefixed name.

So that's what I propose. Actually go for gfortran-for-host and use
<triplet>-gfortran even for native builds. What do you think?

Helmut
diff --minimal -Nru libtool-2.4.7/debian/changelog 
libtool-2.4.7/debian/changelog
--- libtool-2.4.7/debian/changelog      2023-07-17 17:03:58.000000000 +0200
+++ libtool-2.4.7/debian/changelog      2024-10-31 17:47:25.000000000 +0100
@@ -1,3 +1,11 @@
+libtool (2.4.7-7.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Use gfortran-for-host. (Closes: #-1)
+    + As a result gfortran must be triplet-prefixed even in native builds.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Thu, 31 Oct 2024 17:47:25 +0100
+
 libtool (2.4.7-7) unstable; urgency=medium
 
   * Remove obsole Breaks: for oldstable , Provides: libltdl7-dev
diff --minimal -Nru libtool-2.4.7/debian/control libtool-2.4.7/debian/control
--- libtool-2.4.7/debian/control        2023-07-17 17:03:58.000000000 +0200
+++ libtool-2.4.7/debian/control        2024-10-31 17:47:13.000000000 +0100
@@ -1,7 +1,7 @@
 Source: libtool
 Build-Depends: debhelper-compat (= 13),
   file,
-  gfortran | fortran95-compiler,
+  gfortran-for-host | fortran95-compiler,
   automake (>= 1:1.14.1-3),
   autoconf (>= 2.69-7),
   help2man,
diff --minimal -Nru libtool-2.4.7/debian/rules libtool-2.4.7/debian/rules
--- libtool-2.4.7/debian/rules  2023-07-17 17:03:58.000000000 +0200
+++ libtool-2.4.7/debian/rules  2024-10-31 17:47:25.000000000 +0100
@@ -15,6 +15,12 @@
 include /usr/share/dpkg/buildflags.mk
 include /usr/share/dpkg/pkg-info.mk
 
+# Always use triplet-prefixed tools with gfortran-for-host.
+ifeq ($(origin FC),default)
+export FC := $(DEB_HOST_GNU_TYPE)-gfortran
+endif
+export F77 ?= $(FC)
+
 # libltdl needs to conform to policy
 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
        INSTALL_PROGRAM += -s

Reply via email to