[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1104466: autoconf: Keep "-lmingwex" and "-lmoldname" in linker flags



Package: autoconf
Version: 2.71-3.1
Severity: normal
Tags: patch upstream

Dear maintainers,

I am forwarding below a request from Markus Mützel on the debian-octave mailing list (https://lists.debian.org/debian-octave/2025/04/msg00000.html)

To make things easier, I am attaching to this bug report the patch that Markus submitted to the upstream autoconf authors. This patch has been integrated into the upstream Git repository.

Best,

Rafael Laboissière

* Markus Mützel <markus.muetzel@gmx.de> [2025-04-30 12:55]:

Hello,

The Octave developers are using Debian to create the tarballs that are distributed for each new version.

Currently, there is an issue with the latest version of autoconf (autoconf-2.72) that is distributed by Debian: Some Fortran system libraries are (incorrectly) removed from the linker flags when targeting Windows. Without these linker flags, Octave’s binaries still link without errors when targeting Windows. However, some functions (like asin(2)) return wrong values.

Users/distributors who are building Octave for Windows would be affected by that issue if we used autoconf-2.72 to create the distributed tarballs.

To work around that, we are using an older version of autoconf (autoconf-2.71) to create the tarballs. However, that means that we are missing out on some improvements in the latest version of autoconf (e.g., better support for LLVM Flang).

The issue with autoconf-2.72 would be solved by cherry-picking this patch from upstream: https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=9ff9c567b1a7a7e66fa6523d4ceff142b86bddaa

Could you please integrate that change in Debian’s autoconf package?

Thank you!

Markus
commit 9ff9c567b1a7a7e66fa6523d4ceff142b86bddaa
Author: Markus Mützel <markus.muetzel@gmx.de>
Date:   Sun Jan 5 18:14:19 2025 +0000

    Keep "-lmingwex" and "-lmoldname" in linker flags for MinGW
    
    It is needed when building Octave targeting Windows. Without it, the
    implementation of "casin" from the Windows runtime is used instead of
    the replacement from MinGW-w64.  That means that results for the
    "casin" function are wrong without that change.
    * lib/autoconf/fortran.m4: Do not remove "-lmingwex" or "-lmoldname"
    from the linker flags when targeting MinGW.  Removing "-lmingwex" causes
    an incorrect linker resolution for functions like "casin" for projects
    that consist of Fortran and C++ sources.  Removing "-lmoldname" causes
    issues for Fortran projects that try to use POSIX-like C functions
    without a '_' symbol prefix when targeting MinGW.

diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4
index 75631492..0fc7545d 100644
--- a/lib/autoconf/fortran.m4
+++ b/lib/autoconf/fortran.m4
@@ -666,7 +666,7 @@ while test $[@%:@] != 1; do
 	-lang* | -lcrt*.o | -lc | -lgcc* | -lSystem | -libmil | -little \
 	  |-LANG:=* | -LIST:* | -LNO:* | -link)
 	  ;;
-	-lkernel32 | -lmingw* | -lmoldname)
+	-lkernel32)
 	  # Ignore this library only on Windows-like systems.
 	  case $host_os in
 	  cygwin* | msys* | mingw* | windows*) ;;

Reply to: