Re: PW#5-7: Linking shared libraries with -lc
On Fri, 23 Jan 1998, Marcelo E. Magallon wrote:
> On Fri, 23 Jan 1998 jdassen@wi.leidenuniv.nl wrote:
>
> > IMO, shared libraries should use `-lsomelib' for each library they directly
> > depend on, not just `-lc'. For example, the LessTif shared library depends
> > directly on Xt, Xext, X11 (and through them on other X libs). I have linked
> > it "-lXt -lXext -lX11 -lc". Thus, ldd can show proper dependencies on all
> > libraries it depends on:
>
> I'm don't think this is a good idea. I thought so, but after I saw what
> happens when you do things this way... whoops, not good.
>
> Let's say you have a library that provides an interface to several graphic
> formats (png, tiff, jpeg), and you write a program where you use only the
> png related functions, and NEVER touch tiff or jpeg. If the library is
> built in the way you (and I, until a few days ago) propose you end up with
> a program linked against the libraries proving the functions for png, tiff
> and jpeg. If those libraries are not in use before the program runs, they
> are loaded, and the memory requierements for your program increases, a
> lot. The GNU linker is not smart enough to drop the libraries that are not
> used at all, or so I've been told here before.
>
> Second side effect: debian packages for libraries end up depending on a
> lot of stuff they DON'T depend on. It's the programs that depend on many
> libraries, but not the libraries themselves.
>
> > Please change the text to state that shared libraries should include
> > dependency information for all the libraries that they depend on, not
> > only libc.
>
> Of course, other (more experienced) developers may go for this... or I may
> be wrong about the way the linker works.
It would be good if someone more experienced than I am could comment on
Marcelo's arguments against linking shared libraries with `-l'. If his
arguments are valid (I really can't tell) then we'll have to drop this
release goal and the policy proposal.
_any_ input is appreciated!
Thanks,
Chris
-- Christian Schwarz
Do you know schwarz@monet.m.isar.de, schwarz@schwarz-online.com,
Debian GNU/Linux? schwarz@debian.org, schwarz@mathematik.tu-muenchen.de
Visit PGP-fp: 8F 61 EB 6D CF 23 CA D7 34 05 14 5C C8 DC 22 BA
http://www.debian.org http://fatman.mathematik.tu-muenchen.de/~schwarz/
Reply to: