Patch attached. libtool gained its own "-Wl,--as-needed" handling in 2.6.0:
https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=c69efe983d0edbee2b0528d2012e4016d628f362
so Debian's "ltmain-as-needed.diff" is no longer needed, and "dh_autoreconf --as-needed" aborts. The patch makes "--as-needed" a no-op when "ltmain.sh" already supports the flag, which also stops "dh_autoreconf_clean" from trying to reverse a patch that was never applied.
I rebuilt dh_autoreconf with the patch (in an unstable chroot).Then I built abiword in an unstable chroot (failed, same as bug report), and then in an unstable chroot with --extra-package=dh-autoreconf_23_all.deb (passed).
Also create a MR on Salsa (CI is green): https://salsa.debian.org/debian/dh-autoreconf/-/merge_requests/5 Kind regards, Edmund Lodewijks -- Edmund Lodewijks <[email protected]> TZ: UTC+2 / GMT+2
From 37f8c4373a3ca93fdeb1132070d8d3cbea787e17 Mon Sep 17 00:00:00 2001 From: Edmund Lodewijks <[email protected]> Date: Sun, 30 Aug 2026 19:21:34 +0200 Subject: [PATCH] dh_autoreconf: skip ltmain-as-needed.diff when libtool already supports it Since libtool 2.6.0, ltmain.sh handles -Wl,--as-needed and -Wl,--no-as-needed by itself, in a fix equivalent to ltmain-as-needed.diff: https://git.savannah.gnu.org/cgit/libtool.git/commit/?id=c69efe983d0edbee2b0528d2012e4016d628f362 reported at https://savannah.gnu.org/support/?111213 Debian went straight from libtool 2.5.4 to 2.6.2, so the diff stopped applying there and dh_autoreconf --as-needed aborts the build with Hunk #2 FAILED at 7615. dh_autoreconf: error: patch [...] returned exit code 1 Detect that case and turn --as-needed into a no-op. Disabling it before $find_options is built also keeps ltmain.sh out of debian/autoreconf.before and .after, so dh_autoreconf_clean does not try to reverse a patch that was never applied. Bug-Debian: https://bugs.debian.org/1146143 --- dh_autoreconf | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dh_autoreconf b/dh_autoreconf index 60a891b..5349cd3 100755 --- a/dh_autoreconf +++ b/dh_autoreconf @@ -77,6 +77,10 @@ default one). The changes are reverted in dh_autoreconf_clean. You should not prevent LIBTOOLIZE from running with this, as it only works correctly with libtoolize running. +Since libtool 2.6.0, ltmain.sh supports -Wl,--as-needed by itself and this +option does nothing. It is only kept for backwards compatibility and may be +removed in a future release. + =item B<-D>I<dir> B<--sourcedirectory>=I<dir> Run everything in the source directory. Supported only in debhelper compat @@ -107,6 +111,22 @@ shall not be run: =cut +# Check if ltmain.sh handles -Wl,--as-needed on its own. This is the case +# since libtool 2.6.0, which gained a fix equivalent to ltmain-as-needed.diff +# (upstream commit c69efe98, https://savannah.gnu.org/support/?111213). +sub ltmain_supports_as_needed { + my $ltmain = shift; + open(my $fh, '<', $ltmain) or return 0; + while (<$fh>) { + if (/-Wl,--as-needed/) { + close($fh); + return 1; + } + } + close($fh); + return 0; +} + # Check if a configure line matches a certain regular expression sub grep_configure { my $expr = shift; @@ -140,6 +160,15 @@ if (defined($dh{EXCLUDE_FIND}) && $dh{EXCLUDE_FIND} ne '') { my $LTMAIN = "/usr/share/libtool/build-aux/ltmain.sh"; $LTMAIN = "/usr/share/libtool/config/ltmain.sh" if (! -e "$LTMAIN"); +# ltmain-as-needed.diff does not apply to an ltmain.sh which already supports +# -Wl,--as-needed, so ignore the request instead of failing the build. This +# also keeps $LTMAIN out of debian/autoreconf.before and .after, so that +# dh_autoreconf_clean does not try to reverse a patch which was never applied. +if ($dh{AS_NEEDED} && ltmain_supports_as_needed($LTMAIN)) { + verbose_print("$LTMAIN already supports -Wl,--as-needed, ignoring --as-needed"); + delete $dh{AS_NEEDED}; +} + if ($dh{AS_NEEDED}) { $find_options = "$LTMAIN . " . $find_options; } -- 2.47.3
OpenPGP_signature.asc
Description: OpenPGP digital signature

