[sr #111358] libtool link with -dlpreopen fails with error: cannot find the library '' or unhandled argument

Patrice Dumas <[email protected]> Mon, 8 Dec 2025 19:02:38 -0500 (EST)
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
--8323329-655495676-1765238558=:2538003
Content-Type: TEXT/plain; CHARSET=utf-8
Content-Transfer-Encoding: QUOTED-PRINTABLE
Content-Disposition: inline

URL:=0A  <https://savannah.gnu.org/support/?111358>=0A=0A                 S=
ummary: libtool link with -dlpreopen fails with error:=0Acannot find the li=
brary '' or unhandled argument=0A                   Group: GNU Libtool=0A  =
             Submitter: pertusus=0A               Submitted: Tue 09 Dec 202=
5 01:02:30 AM CET=0A                Category: None=0A                Priori=
ty: 5 - Normal=0A                Severity: 3 - Normal=0A                  S=
tatus: None=0A                 Privacy: Public=0A             Assigned to: =
None=0A        Originator Email:=0A             Open/Closed: Open=0A       =
  Discussion Lock: Unlocked=0A        Operating System: None=0A=0A=0A    __=
_____________________________________________________=0A=0AFollow-up Commen=
ts:=0A=0A=0A-------------------------------------------------------=0ADate:=
 Tue 09 Dec 2025 01:02:30 AM CET By: Patrice Dumas <pertusus>=0AWith one li=
brary lib1 having in LDFLAGS -dlpreopen lib2.la there is an error=0Ain a de=
bian GNU/Linux testing:=0A=0ALibtool is called like:=0A/bin/bash ./libtool =
 --tag=3DCC   --mode=3Dlink gcc  -g -O2  -avoid-version=0A-dlpreopen lib2.l=
a  -o lib1.la -rpath /usr/local/lib lib1.lo=0A=0Aand errors with=0Alibtool:=
   error: cannot find the library '' or unhandled argument=0A'./.libs/lib2.=
so'=0A=0AA reproducer is attached, using autoconf and automake.=0A=0A=0AWit=
h set -x, the code leading to the error in the libtool script can be=0Aanal=
ysed:=0A=0Ain func_mode_link (), starting l 7518 arguments are handled, -dl=
preopen set=0Aprev to dlprefiles, then lib2.la is found and added to dlpref=
iles.=0A=0AAfter arguments are handled, around l 8447 linkmode is set to li=
b.=0A=0Al 8490 passes is set to "conv dlpreopen link".=0A=0AIn the *conv pa=
ss*, nothing much happens.=0A=0AIn the *dlpreopen pass*, deplibs is set to =
'./.libs/lib2.so '.=0A=0AIn more details, first we get to # Collect and for=
ward deplibs of preopened=0Alibtool libs, and libs is set to dlprefiles.=0A=
=0AThen analysing deplib in $libs l 8571 case matches *.la, lib2.la is sour=
ced,=0A$library_names is set to 'lib2.so lib2.so lib2.so', linklib is set t=
o lib2.so=0Aaround l 8884, the library is found in objdir=3D.libs.=0A=0A(l =
8988 in test $dlname is set, =3D> ./.libs/lib2.so is added to=0Anewdlprefil=
es.)=0A=0AFollowing codes are for other passes.=0A=0A(l 9103 lib2.la is add=
ed to notinst_deplibs; compile_rpath is set.)=0A=0Al 9214 match relink !=3D=
 "$opt_mode" (opt_mode=3Dlink), case $hardcode_action is=0Aimmediate, $hard=
code_direct =3D no, add=3D$dir/$linklib=0A =3D> add=3D./.libs/lib2.so.=0Al =
9298 else is followed, test -n "$add" && deplibs=3D"$add $deplibs"=0A =3D> =
deplibs=3D'./.libs/lib2.so '=0A=0Al 9405 match, but nothing done, then ther=
e is another code run starting l=0A9534, with vars eval'ed, but not much se=
ems to be done.=0A=0AIn the *link pass*, a failure happens when analysing d=
eplib in $libs l 8571,=0A./.libs/lib2.so does not match any of the case bra=
nches.  Maybe a .la would=0Ahave been expected instead?=0A=0A=0A=0A=0A=0A=
=0A=0A    _______________________________________________________=0AFile At=
tachments:=0A=0Areproducer using autoconf, automake and libtool=0A=0AName: =
test_dlpreopen-0.0.tar.gz      Size: 351KiB=0A=0A<https://file.savannah.gnu=
.org/file/test_dlpreopen-0.0.tar.gz?file_id=3D57932>=0A=0A=0A=0A    AGPL NO=
TICE=0A=0AThese attachments are served by Savane. You can download the corr=
esponding=0Asource code of Savane at=0Ahttps://savannah.gnu.org/source/sava=
ne-598c8b2cb7a148d45198be451a0effb4c5529af4.tar.gz=0A=0A    _______________=
________________________________________=0A=0AReply to this item at:=0A=0A =
 <https://savannah.gnu.org/support/?111358>=0A=0A__________________________=
_____________________=0AMessage sent via Savannah=0Ahttps://savannah.gnu.or=
g/=0A
--8323329-655495676-1765238558=:2538003
Content-Type: APPLICATION/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaTdnHgAKCRCqLAuaBUf3
TvK4AQDBfxIJ5f24z6BeMeYbSOnNAgIrPuWmQ5HNBYmrdZSxygEA6cYWjA7cbUES
HKCHn+cr0gMGolugEHC3pEEXi3dqSQQ=
=Egbq
-----END PGP SIGNATURE-----

--8323329-655495676-1765238558=:2538003--