URL:
  <https://savannah.gnu.org/support/?111326>

                 Summary: Libtool dangerously adds -L arguments during
relinking
                   Group: GNU Libtool
               Submitter: 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
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Mon 20 Oct 2025 03:19:04 PM UTC By: Pierre Ossman <cendossm>
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.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?111326>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to