GNU bug report logs - #60731
configure does not check for space behind "-l"

Previous Next

Package: libtool;

Reported by: Christian Weiss <Christian.Weiss <at> EMEA.NEC.COM>

Date: Wed, 11 Jan 2023 14:00:03 UTC

Severity: normal

Done: Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60731 in the body.
You can then email your comments to 60731 AT debbugs.gnu.org in the normal way.

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-automake <at> gnu.org:
bug#60731; Package automake. (Wed, 11 Jan 2023 14:00:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christian Weiss <Christian.Weiss <at> EMEA.NEC.COM>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Wed, 11 Jan 2023 14:00:03 GMT) Full text and rfc822 format available.

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

From: Christian Weiss <Christian.Weiss <at> EMEA.NEC.COM>
To: "bug-automake <at> gnu.org" <bug-automake <at> gnu.org>
Subject: configure does not check for space behind "-l"
Date: Wed, 11 Jan 2023 12:12:37 +0000
[Message part 1 (text/plain, inline)]
Dear all,

I have an issue which relates to the parsing of libraries for the linking step.
To reproduce this error, I have used automake 2.71 and OpenMPI 4.1.2
Consider this configure.ac:

AC_INIT([bug_mpi], [0], [dummy])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_FC
AC_PROG_CXX
LT_INIT
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

And Makefile.am:

lib_LTLIBRARIES = libtest.la
libtest_la_SOURCES = test_f.f90 test_c.c

i.e. a library is supposed to be created from a C and a Fortran source file. The explicit form of the source files is irrelevant.

I configure and build with MPI: ./configure CC=mpicc FC=mpif90 CXX=mpic++
Which leads to the following error message:

/usr/bin/ld: cannot find -l-L/opt/bm/gcc-10.2.0/lib/gcc/x86_64-pc-linux-gnu/10.2.0

This is due to empty "-l" commands in the linker command. I could find out that this originates from the call of  "mpif90 -v", which configure uses to create the list of  libraries to link. Explicitly, in my case I get

mpif90 -v test.f90 2>&1 | grep Driving
Driving: /opt/bm/gcc-10.2.0/bin/gfortran -v test.f90 -I/opt/bm/hpcx-v2.10-gcc-MLNX_OFED_LINUX-5-redhat8-cuda11-gdrcopy2-nccl2.11-x86_64/hpcx-rebuild-gcc-9.2.0-mt.sh/include -pthread -I/opt/bm/hpcx-v2.10-gcc-MLNX_OFED_LINUX-5-redhat8-cuda11-gdrcopy2-nccl2.11-x86_64/hpcx-rebuild-gcc-9.2.0-mt.sh/lib -L/opt/bm/hpcx-v2.10-gcc-MLNX_OFED_LINUX-5-redhat8-cuda11-gdrcopy2-nccl2.11-x86_64/hpcx-rebuild-gcc-9.2.0-mt.sh/lib -Wl,-rpath -Wl,/opt/bm/hpcx-v2.10-gcc-MLNX_OFED_LINUX-5-redhat8-cuda11-gdrcopy2-nccl2.11-x86_64/hpcx-rebuild-gcc-9.2.0-mt.sh/lib -Wl,--enable-new-dtags -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -l gfortran -l m -shared-libgcc

Note the highlighted libraries which have a space between the "-l" and the library name. This string occurs in the postdeps variable of the libtool script.
I am aware that the existence of that extra space originates from OpenMPI. I have observed this with a few other OpenMPI installations, but other MPI implementations might not have it.
However, I found the following in the configure script:

  for p in `eval "$output_verbose_link_cmd"`; do
    case ${prev}${p} in

    -L* | -R* | -l*)
       # Some compilers place space between "-{L,R}" and the path.
       # Remove the space.
       if test $p = "-L" ||
          test $p = "-R"; then
         prev=$p
         continue
       fi

Here, you explicitly check for spaces within -L and -R statements. If I add "-l" to this, the build succeeds.
Maybe this check could be automatically generated, too?

Best regards,
Christian

Dr. Christian Weiss
Benchmark Analyst
Tel: +49 211 5369 126

NEC Deutschland GmbH
Geschäftsführer  Yuichi Kojima
Handelsregister Düsseldorf HRB 57941; VAT ID DE129424743

[Message part 2 (text/html, inline)]

bug reassigned from package 'automake' to 'libtool'. Request was from Karl Berry <karl <at> freefriends.org> to control <at> debbugs.gnu.org. (Thu, 12 Jan 2023 02:10:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-libtool <at> gnu.org:
bug#60731; Package libtool. (Thu, 12 Jan 2023 02:12:02 GMT) Full text and rfc822 format available.

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

From: Karl Berry <karl <at> freefriends.org>
To: Christian.Weiss <at> EMEA.NEC.COM
Cc: bug-libtool <at> gnu.org, 60731 <at> debbugs.gnu.org
Subject: Re: bug#60731: configure does not check for space behind "-l"
Date: Wed, 11 Jan 2023 19:11:36 -0700
Hi Christian - thanks for the report.

        -L* | -R* | -l*)
           # Some compilers place space between "-{L,R}" and the path.
           # Remove the space.
           if test $p = "-L" ||
              test $p = "-R"; then

From the case label, it seems clear that -l was intended to be
supported and simply missed from the if statement. 

However, this code is in libtool[.m4], not automake. Attempting to
reassign the bug there. I don't know if debbugs will send mail to the
new list, so explicitly cc-ing bug-libtool. (Hope we don't end up with
two bug numbers.) --best, karl.





Information forwarded to bug-libtool <at> gnu.org:
bug#60731; Package libtool. (Thu, 12 Jan 2023 02:12:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-libtool <at> gnu.org:
bug#60731; Package libtool. (Fri, 13 Jan 2023 11:11:02 GMT) Full text and rfc822 format available.

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

From: Peter Johansson <trojkan <at> gmail.com>
To: Christian Weiss <Christian.Weiss <at> EMEA.NEC.COM>, 60731 <at> debbugs.gnu.org
Subject: Re: bug#60731: configure does not check for space behind "-l"
Date: Fri, 13 Jan 2023 21:10:21 +1000
[Message part 1 (text/plain, inline)]
Hi Christian,

On 11/1/23 22:12, Christian Weiss wrote:
> However, I found the following in the configure script:
>
>   for p in `eval "$output_verbose_link_cmd"`; do
>
>     case ${prev}${p} in
>
>     -L* | -R* | -l*)
>
>        # Some compilers place space between "-{L,R}" and the path.
>
>        # Remove the space.
>
>        if test $p = "-L" ||
>
>           test $p = "-R"; then
>
>          prev=$p
>
>          continue
>
>        fi
>

That shell code is coming from libtool, presumably expanded from the 
LT_INIT macro. You might have better luck asking on libtool <at> gnu.org


Cheers,

Peter

[Message part 2 (text/html, inline)]

Reply sent to Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>:
You have taken responsibility. (Sat, 17 Feb 2024 16:50:02 GMT) Full text and rfc822 format available.

Notification sent to Christian Weiss <Christian.Weiss <at> EMEA.NEC.COM>:
bug acknowledged by developer. (Sat, 17 Feb 2024 16:50:02 GMT) Full text and rfc822 format available.

Message #21 received at 60731-done <at> debbugs.gnu.org (full text, mbox):

From: Ileana Dumitrescu <ileanadumitrescu95 <at> gmail.com>
To: 60731-done <at> debbugs.gnu.org
Cc: Christian.Weiss <at> EMEA.NEC.COM
Subject: Re: bug#60731: configure does not check for space behind "-l"
Date: Sat, 17 Feb 2024 18:48:19 +0200
[Message part 1 (text/plain, inline)]
Hi Christian - thanks again for the report.

I fixed it with Karl's advice.

-- 
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)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 17 Mar 2024 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 33 days ago.

Previous Next


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