[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Linking shared libraries with -lc



I made a list of packages that include shared libraries for which ldd
says "statically linked".  I plan to use this list to automatically
generate bug reports (about 50).  However, I am unsure of the text 
to use.  This is my first try:

--------------------------------------------------------------------
Package: %s
Version: %s

This is an automated bugreport.

The package %s contains a shared library that should be
explicitly linked with the libraries it depends on.
Filename:  %s

Explicit linking of shared libraries has several advantages, the most
important of which is that it allows the dynamic linker to detect
conflicts between library versions.

Every shared library should at least be linked explicitly with libc,
by passing -lc to the linker.

When this is done, the package should use dpkg-shlibdeps on the shared
libraries to generate a correct Depends: line automatically.
--------------------------------------------------------------------

I would like to add a "For more information, see..." paragraph to
that, but I could not find a reference.  I dug up some things from the
mailing list, though:

---- From Brian White's "Upcoming Debian Releases" mailings ----
* Link shared libs against other shared libs instead of static [14]

14 - Link shared libraries themselves against other shared libs, instead of
     including their code static (e.g. as current S-Lang already does); this
     can reduce memory use.  -- jdassen@wi.leidenuniv.nl (J.H.M.Dassen)

      See H.J. Lu's "ELF: From The Programmer's Perspective"
      <URL:ftp://tsx-11.mit.edu/pub/linux/packages/GCC/elf.ps.gz> for details.
----------------------------------------------------------------

---- From an update Ray Dassen mailed on Sep 23 ----
14 - Link shared libraries themselves against other shared libs, instead 
     of including their code statically. This has several advantages. It
     allows the linker to warn about "mixed libc5/libc6 binaries", and,
     more general, makes the dependencies of shared libraries themselves
     more explicit; this should be used in generating the Depends: line of
     a library package (e.g. through dpkg-shlibdeps). This could prevent
     subtle bugs resulting from interactions between code (statically
     included) from incompatible library versions. Also, it can reduce
     memory use. -- jdassen@wi.leidenuniv.nl (J.H.M. Dassen)

     See H.J. Lu's "ELF: From The Programmer's Perspective"
     <URL:ftp://tsx-11.mit.edu/pub/linux/packages/GCC/elf.ps.gz> for
     details.
----------------------------------------------------

---- From a comment Mark Baker made on Nov 23 ----
> * Link shared libs against other shared libs instead of static [14]

What you mean is `link shared libs so they contain dependency information'.

If you don't do that, ldd says `statically linked' but that's just a very
misleading error, since libraries are never statically linked.
--------------------------------------------------

I hope that someone can take this information and straighten it out to
turn it into a nice proposal for the policy manual.

Richard Braakman


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: