URL: <https://savannah.gnu.org/support/?111358>
Summary: libtool link with -dlpreopen fails with error:
cannot find the library '' or unhandled argument
Group: GNU Libtool
Submitter: pertusus
Submitted: Tue 09 Dec 2025 01:02:30 AM CET
Category: None
Priority: 5 - Normal
Severity: 3 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Unlocked
Operating System: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Tue 09 Dec 2025 01:02:30 AM CET By: Patrice Dumas <pertusus>
With one library lib1 having in LDFLAGS -dlpreopen lib2.la there is an error
in a debian GNU/Linux testing:
Libtool is called like:
/bin/bash ./libtool --tag=CC --mode=link gcc -g -O2 -avoid-version
-dlpreopen lib2.la -o lib1.la -rpath /usr/local/lib lib1.lo
and errors with
libtool: error: cannot find the library '' or unhandled argument
'./.libs/lib2.so'
A reproducer is attached, using autoconf and automake.
With set -x, the code leading to the error in the libtool script can be
analysed:
in func_mode_link (), starting l 7518 arguments are handled, -dlpreopen set
prev to dlprefiles, then lib2.la is found and added to dlprefiles.
After arguments are handled, around l 8447 linkmode is set to lib.
l 8490 passes is set to "conv dlpreopen link".
In the *conv pass*, nothing much happens.
In the *dlpreopen pass*, deplibs is set to './.libs/lib2.so '.
In more details, first we get to # Collect and forward deplibs of preopened
libtool libs, and libs is set to dlprefiles.
Then analysing deplib in $libs l 8571 case matches *.la, lib2.la is sourced,
$library_names is set to 'lib2.so lib2.so lib2.so', linklib is set to lib2.so
around l 8884, the library is found in objdir=.libs.
(l 8988 in test $dlname is set, => ./.libs/lib2.so is added to
newdlprefiles.)
Following codes are for other passes.
(l 9103 lib2.la is added to notinst_deplibs; compile_rpath is set.)
l 9214 match relink != "$opt_mode" (opt_mode=link), case $hardcode_action is
immediate, $hardcode_direct = no, add=$dir/$linklib
=> add=./.libs/lib2.so.
l 9298 else is followed, test -n "$add" && deplibs="$add $deplibs"
=> deplibs='./.libs/lib2.so '
l 9405 match, but nothing done, then there is another code run starting l
9534, with vars eval'ed, but not much seems to be done.
In the *link pass*, a failure happens when analysing deplib in $libs l 8571,
./.libs/lib2.so does not match any of the case branches. Maybe a .la would
have been expected instead?
_______________________________________________________
File Attachments:
reproducer using autoconf, automake and libtool
Name: test_dlpreopen-0.0.tar.gz Size: 351KiB
<https://file.savannah.gnu.org/file/test_dlpreopen-0.0.tar.gz?file_id=57932>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-598c8b2cb7a148d45198be451a0effb4c5529af4.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/support/?111358>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
