[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Including static libraries in shared libraries with libtool.
From: |
Bob Friesenhahn |
Subject: |
Re: Including static libraries in shared libraries with libtool. |
Date: |
Sun, 26 Sep 2004 18:19:11 -0500 (CDT) |
On Sun, 26 Sep 2004, Howard Chu wrote:
Using recent Automake, I find that I am able to eliminate use of
convenience libraries by using a non-recursive build and referring to
sources in subdirectories. A simple Automake macro refers to all the
objects which would be equivalent to a convenience "library". Works great
and avoids the overhead imposed by libtool since libtool must extract all
the objects from the archive file prior to using them.
One more time, shouting into the senseless void...
It is strange that if you yell into my left ear, amplified sound comes
out of my right ear. :-)
If these so-called "convenience" libraries are meant to be linked in whole,
they should not be ar archives at all. You should just link them directly
into a relocatable object file:
ld -r -o <convenience.obj> *.o
The linker is faster, and it will resolve a majority of external symbol
references immediately; i.e., all of the cross references between those .o
files. Then when it comes time to combine all the convenience pieces into a
single program, that step will also be faster and there's no wasted time
extracting/deleting archive members.
Of course. Convenience libraries simply exist to assist
poorly-structured projects with broken Makefiles. They exist due to a
legacy of bad design. However, they can be very convenient.
And as a previous post points out, just because object files are stored in an
archive library is no reason to assume they are non-PIC code and thus
unusable. That was the whole point of the other thread - that there is no
consistent way to check for PIC vs non-PIC in advance.
But again, if all you plan to do is link *all* of the objects together, e.g.
for a shared library or for a "convenience" library, then you should just use
"ld -r" and skip all the other intermediate crap.
Right. Usually convenience libraries are built in a different
directory by a different Makefile so there is no one place that knows
the whole equation. They can also be used to build bloated libraries
or which waste disk space and memory due to redundant components which
can't be shared.
This is REALLY REALLY basic ld usage practice, I'm really amazed that you
guys keep inventing newer, harder ways to do things.
Automake's support for source files in subdirectories is pretty easy
to use and reasonably efficient.
Bob
======================================
Bob Friesenhahn
address@hidden
http://www.simplesystems.org/users/bfriesen
- Including static libraries in shared libraries with libtool., Sam Varshavchik, 2004/09/25
- Re: Including static libraries in shared libraries with libtool., Simon Richter, 2004/09/26
- Re: Including static libraries in shared libraries with libtool., Sam Varshavchik, 2004/09/26
- Re: Including static libraries in shared libraries with libtool., Bob Friesenhahn, 2004/09/26
- Re: Including static libraries in shared libraries with libtool., Howard Chu, 2004/09/26
- Re: Including static libraries in shared libraries with libtool., Sam Varshavchik, 2004/09/26
- Re: Including static libraries in shared libraries with libtool., Howard Chu, 2004/09/26
- Re: Including static libraries in shared libraries with libtool., Bob Friesenhahn, 2004/09/26
- Re: Including static libraries in shared libraries with libtool., Howard Chu, 2004/09/26
- Re: Including static libraries in shared libraries with libtool., Joe Orton, 2004/09/27
- Re: Including static libraries in shared libraries with libtool.,
Bob Friesenhahn <=
- Re: Including static libraries in shared libraries with libtool., Albert Chin, 2004/09/27
- Re: Including static libraries in shared libraries with libtool., Fredrick Meunier, 2004/09/26
- Re: Including static libraries in shared libraries with libtool., Bob Friesenhahn, 2004/09/26