mainGNU Libtool - Support: sr #111326, Libtool dangerously adds -L...

 
 

sr #111326: Libtool dangerously adds -L arguments during relinking

Submitter:  Pierre Ossman <cendossm>
Submitted:  Mon 20 Oct 2025 03:19:04 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  None
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Mon 20 Oct 2025 03:19:04 PM UTC, original submission:  

If you have internal libraries in a project, then libtool wants to do some relinking magic when you install them.

However, it is overly pessimistic about how to link those and adds the line:

  -L<DESTDIR>/usr/lib -L/usr/lib -linternallib

That second -L should be pointless, as the newly built library should be in <DESTDIR>/usr/lib. And it is extremely dangerous, as that -L will not just affect -linternallib, but everything else that follows.

When cross compiling between compatible architectures, this breaks spectacularly. The linker will then grab things from the build system, instead of from the correct sysroot.

libtool 2.5.1 improved this by looking at lt_sysroot. But that can still be fragile, as it's easy to overlook setting up sysroot for libtool as it is often not needed.

I would request getting rid of that extra -L, at least in most scenarios, to have a more reliable result.

Pierre Ossman <cendossm>

 

Attached Files

This item currently has no attached files.

(Note: upload size limit is set to 4.0MiB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by cendossm (Submitted the item)
  •  

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16-598c.
    Corresponding source code