GNU bug report logs - #76177
_LT_SYS_HIDDEN_LIBDEPS oddities with Fortran

Previous Next

Package: libtool;

Reported by: Christian Feld <christian.feld <at> posteo.de>

Date: Mon, 10 Feb 2025 12:36:02 UTC

Severity: normal

To reply to this bug, email your comments to 76177 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-libtool <at> gnu.org:
bug#76177; Package libtool. (Mon, 10 Feb 2025 12:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christian Feld <christian.feld <at> posteo.de>:
New bug report received and forwarded. Copy sent to bug-libtool <at> gnu.org. (Mon, 10 Feb 2025 12:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christian Feld <christian.feld <at> posteo.de>
To: bug-libtool <at> gnu.org
Cc: Gregor Corbin <g.corbin <at> fz-juelich.de>,
 Christian Feld <c.feld <at> fz-juelich.de>
Subject: _LT_SYS_HIDDEN_LIBDEPS oddities with Fortran
Date: Mon, 10 Feb 2025 10:53:07 +0000
[Message part 1 (text/plain, inline)]
Dear libtoolers,

my project uses C, C++, Fortran 77. One library consists of mixed CC and 
F77 sources. I intend to switch to more modern Fortran (FC) for this 
library.

Linking this library with F77LINK worked well. Switching to FCLINK 
causes errors for some compilers due to broken postedeps_FC.

 - For HPE Cray PrgEnv-cray's ftn, postedeps_FC contains '... -L -L 
...'.
 - For HPE Cray PrgEnv-gnu's ftn, OpenMPI's and MPICH's mpifort 
(delegating to gfortran), postedeps_FC contains '... -l -l ...'.

During investigating the cause of the broken postdeps_FC, several 
questions arose.

1. Why do we have postdeps for CXX and FC, but not for CC and F77?  
_LT_SYS_HIDDEN_LIBDEPS is expanded in _LT_LANG_CXX_CONFIG and 
_LT_LANG_FC_CONFIG only.

2. Why do we need postdeps at all? Isn't the compiler supposed to do 
just the right thing?

3. Without a C++ compiler (AC_PROG_CXX), postedeps_FC is always empty, 
as output_verbose_link_cmd, the command producing the input to determine 
the postdeps, is set in _LT_LANG_CXX_CONFIG only. If this is coupling 
intended, can you please explain why?


Now, where do the bogus `... -L -L ...` and `... -l -l ...` come from? 
The output_verbose_link_cmd used for CXX and FC postdeps is
    '$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v 
"^Configured with:" | $GREP " [[-]]L"'
For the compilers mentioned above, the output of this command contains a 
line starting with 'Driving:', e.g.,

Driving: 
/p/software/jedi/stages/2025/software/GCCcore/13.3.0/bin/gfortran 
-shared -g -O2 -v conftest.o 
-I/p/software/default/stages/2025/software/OpenMPI/5.0.5-GCC-13.3.0/include 
-I/p/software/default/stages/2025/software/OpenMPI/5.0.5-GCC-13.3.0/lib 
-L/p/software/default/stages/2025/software/OpenMPI/5.0.5-GCC-13.3.0/lib 
-Wl,-rpath 
-Wl,/p/software/default/stages/2025/software/OpenMPI/5.0.5-GCC-13.3.0/lib 
-Wl,--enable-new-dtags -lmpi_usempif08 -lmpi_usempi_ignore_tkr 
-lmpi_mpifh -lmpi -l gfortran -l m -shared-libgcc

The part '-l gfortran -l m' results in '... -l -l ...'


Lines starting with 'Configured with:' are already omitted in 
output_verbose_link_cmd. Omitting lines starting with 'Driving:'  as 
well would fix the invalid postdeps_FC. Note that autoconf's 
_AC_PROG_FC_V_OUTPUT also omits both, '^Driving:' and '^Configured 
with:', see [1].

A patch omitting lines '^Driving:'  is attached. But do we need to 
expand _LT_SYS_HIDDEN_LIBDEPS for FC at all?

Thanks,
Christian

[1] 
https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob;f=lib/autoconf/fortran.m4;h=cdc197bd67f4abab036cfe6a3a59d16aa712a386;hb=6199cff2909e0ac84c9391aa49ed097d6a33268d#l514
[output_verbose_link_cmd.patch (text/x-patch, attachment)]

Information forwarded to bug-libtool <at> gnu.org:
bug#76177; Package libtool. (Mon, 10 Feb 2025 19:52:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christian Feld <c.feld <at> fz-juelich.de>
To: <bug-libtool <at> gnu.org>
Cc: Gregor Corbin <g.corbin <at> fz-juelich.de>
Subject: Re: _LT_SYS_HIDDEN_LIBDEPS oddities with Fortran
Date: Mon, 10 Feb 2025 19:28:45 +0100
[Message part 1 (text/plain, inline)]
I tried again with the latest libtool release. With that version, I 
don't see the '... -l -l ...' and '... -L -L ...'. Good!

The observation that postedeps_FC is empty in the absence of AC_PROG_CXX 
still holds, though.

Christian


On 10.02.25 11:53, Christian Feld wrote:
> Dear libtoolers,
> 
> my project uses C, C++, Fortran 77. One library consists of mixed CC and 
> F77 sources. I intend to switch to more modern Fortran (FC) for this 
> library.
> 
> Linking this library with F77LINK worked well. Switching to FCLINK 
> causes errors for some compilers due to broken postedeps_FC.
> 
>   - For HPE Cray PrgEnv-cray's ftn, postedeps_FC contains '... -L -L ...'.
>   - For HPE Cray PrgEnv-gnu's ftn, OpenMPI's and MPICH's mpifort 
> (delegating to gfortran), postedeps_FC contains '... -l -l ...'.
> 
> During investigating the cause of the broken postdeps_FC, several 
> questions arose.
> 
> 1. Why do we have postdeps for CXX and FC, but not for CC and F77? 
> _LT_SYS_HIDDEN_LIBDEPS is expanded in _LT_LANG_CXX_CONFIG and 
> _LT_LANG_FC_CONFIG only.
> 
> 2. Why do we need postdeps at all? Isn't the compiler supposed to do 
> just the right thing?
> 
> 3. Without a C++ compiler (AC_PROG_CXX), postedeps_FC is always empty, 
> as output_verbose_link_cmd, the command producing the input to determine 
> the postdeps, is set in _LT_LANG_CXX_CONFIG only. If this is coupling 
> intended, can you please explain why?
> 
> 
> Now, where do the bogus `... -L -L ...` and `... -l -l ...` come from? 
> The output_verbose_link_cmd used for CXX and FC postdeps is
>      '$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v 
> "^Configured with:" | $GREP " [[-]]L"'
> For the compilers mentioned above, the output of this command contains a 
> line starting with 'Driving:', e.g.,
> 
> Driving: /p/software/jedi/stages/2025/software/GCCcore/13.3.0/bin/ 
> gfortran -shared -g -O2 -v conftest.o -I/p/software/default/stages/2025/ 
> software/OpenMPI/5.0.5-GCC-13.3.0/include -I/p/software/default/ 
> stages/2025/software/OpenMPI/5.0.5-GCC-13.3.0/lib -L/p/software/default/ 
> stages/2025/software/OpenMPI/5.0.5-GCC-13.3.0/lib -Wl,-rpath -Wl,/p/ 
> software/default/stages/2025/software/OpenMPI/5.0.5-GCC-13.3.0/lib - 
> Wl,--enable-new-dtags -lmpi_usempif08 -lmpi_usempi_ignore_tkr - 
> lmpi_mpifh -lmpi -l gfortran -l m -shared-libgcc
> 
> The part '-l gfortran -l m' results in '... -l -l ...'
> 
> 
> Lines starting with 'Configured with:' are already omitted in 
> output_verbose_link_cmd. Omitting lines starting with 'Driving:'  as 
> well would fix the invalid postdeps_FC. Note that autoconf's 
> _AC_PROG_FC_V_OUTPUT also omits both, '^Driving:' and '^Configured 
> with:', see [1].
> 
> A patch omitting lines '^Driving:'  is attached. But do we need to 
> expand _LT_SYS_HIDDEN_LIBDEPS for FC at all?
> 
> Thanks,
> Christian
> 
> [1] https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=blob;f=lib/ 
> autoconf/ 
> fortran.m4;h=cdc197bd67f4abab036cfe6a3a59d16aa712a386;hb=6199cff2909e0ac84c9391aa49ed097d6a33268d#l514

[smime.p7s (application/pkcs7-signature, attachment)]

Information forwarded to bug-libtool <at> gnu.org:
bug#76177; Package libtool. (Thu, 27 Feb 2025 16:56:03 GMT) Full text and rfc822 format available.

Message #11 received at 76177 <at> debbugs.gnu.org (full text, mbox):

From: Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>
To: 76177 <at> debbugs.gnu.org
Cc: Gregor Corbin <g.corbin <at> fz-juelich.de>,
 Christian Feld <c.feld <at> fz-juelich.de>
Subject: Re: bug#76177: _LT_SYS_HIDDEN_LIBDEPS oddities with Fortran
Date: Thu, 27 Feb 2025 18:54:59 +0200
[Message part 1 (text/plain, inline)]
>> A patch omitting lines '^Driving:'  is attached. But do we need to 
>> expand _LT_SYS_HIDDEN_LIBDEPS for FC at all?

Thank you for your bug report. I have applied your patch to the
development branch [1].

I am still not sure if expanding _LT_SYS_HIDDEN_LIBDEPS for FC is
required. If it is not breaking anything, I will likely keep it
the same.

[1] 
https://git.savannah.gnu.org/cgit/libtool.git/commit/?h=development&id=f93cf989fab1d9af2fad7c813f71bdf4d273a5f9

-- 
Ileana Dumitrescu

GPG Public Key: FA26 CA78 4BE1 8892 7F22 B99F 6570 EA01 146F 7354

[OpenPGP_0x6570EA01146F7354.asc (application/pgp-keys, attachment)]
[OpenPGP_signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 4 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.