URL: <https://savannah.gnu.org/patch/?10569>
Summary: FIx old_deplibs usage / archive-in-archive test
Group: GNU Libtool
Submitter: espresso
Submitted: Tue 28 Apr 2026 03:08:32 PM UTC
Category: None
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Unlocked
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Tue 28 Apr 2026 03:08:32 PM UTC By: Alexandre Janniaux <espresso>
Hi,
I'm re-submitting patches that I've sent a while ago, and that
I need to make partial linking work properly in VLC.
You can find the original submission there:
[patch1]:
https://lists.gnu.org/archive/html/libtool-patches/2021-04/msg00000.html
[patch2]:
https://lists.gnu.org/archive/html/libtool-patches/2021-04/msg00001.html
[repro]:
https://lists.gnu.org/archive/html/libtool-patches/2021-04/msg00003.html
In the meantime, I've started using those patches and never pinged
for the merge as I hadn't 100% understanding of why it was made like
this, and I didn't write the test case for it.
Now, I'm starting to merge the partial linking feature in VLC and I
would appreciate not keeping the patch for myself in our repository as
it is much easier to handle, so I've made the test and investigations
to provide context.
After some research, i.e. realizing when writing the test that I was
actually breaking another one, it seems that I've been solving an
issue originating[^thomastanner] back to 1999.
[^thomastanner]:
https://cgit.git.savannah.gnu.org/cgit/libtool.git/commit/?id=4b506921
The symptoms are the following: when doing partial linking with static
dependencies, the static libraries from the dependencies are actually
appended to the archive command and are nested into the archive
itself, leading to the linker complaining when using the partially
linked archive in the end:
ld: ./.libs/lib.a: member ./.libs/lib.a(libexternal.a) in archive is not
an object
The problem was partially addressed[^oldarchivecmds] by Peter O'Gorman
who removed the duplicate that was added to old_archive_cmds and
introduced[^dmacks] the archive-in-archive.at test to signal this,
using AT_XFAIL_IF to notify this was not working correctly.
[^oldarchivecmds]:
https://cgit.git.savannah.gnu.org/cgit/libtool.git/commit/?id=e18e516a
[^dmacks]:
https://lists.gnu.org/archive/html/libtool-patches/2007-06/msg00004.html
Then we also had changes from Peter Rosin that added partial test
success for Microsoft's lib, I guess to have the testsuite working
despite the behavior.
Then, fast-forward to 2021, I stumbled upon the error above when
implementing the partial linking integration and created a
repository[^ltrltest] to test and trigger the issue, from which I made
and sent the original patches.
[^ltrltest]: https://github.com/alexandre-janniaux/libtool-relocatable-tests
In my understanding, libtool defines the convenience library and
old libraries differently, as one is a bundle of object that happens
to be stored as a static archive, but is really meant to provide the
objects to the target it's linked to, whereas the other is referring
to static library, which means that the linker is only pulling what it
needs to pull from it.
In addition, when generating a libtool library, it is expected to also
use libtool to link this libtool library against a target, while
forwarding the dependencies properly. By that sentence, I mean that if
the dependency is not linked by libtool, that's not a libtool problem,
but if it is, libtool should make sure it forwards and provides the
dependencies in an adequate manner.
Libtool does have the necessary mechanism in the libtool archive, but
the static libraries that were linked against the libtool archives
were not forwarded through this but the archive itself instead.
This patchset fixes this old issue and properly address this last
point by forwarding those old library dependencies through the
dependency_libs field of the libtool archive, so that they are
resolved at the final link stage. It also updates the tests so that
the problem is marked as resolved.
_______________________________________________________
File Attachments:
Name: 0001-ltmain.in-ensure-old-libraries-are-not-archived.patch Size: 4.6KiB
<https://file.savannah.gnu.org/file/0001-ltmain.in-ensure-old-libraries-are-not-archived.patch?file_id=58521>
Name: 0002-tests-extend-archive-in-archive-with-dependency-forw.patch Size:
1.7KiB
<https://file.savannah.gnu.org/file/0002-tests-extend-archive-in-archive-with-dependency-forw.patch?file_id=58522>
Name: 0003-ltmain.in-defer-warn-dependency-to-static-library.patch Size:
1.4KiB
<https://file.savannah.gnu.org/file/0003-ltmain.in-defer-warn-dependency-to-static-library.patch?file_id=58523>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-c36938be85ff6c1b727bc7dd7fd30e48f9142870.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/patch/?10569>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
