Subject: Re: "-Ldir -lname" vs. "dir/"
To: None <>
From: David Laight <>
List: tech-toolchain
Date: 03/18/2002 22:21:19
On Mon, Mar 18, 2002 at 01:42:33PM -0800, Johnny Lam wrote:
> I'm going to try to reformulate with a simpler example to try to make
> clearer what I perceive to be the problem.  The following example is
> distilled from something I received in private email regarding problems
> with packages having hidden dependencies on devel/gettext-lib.

This would be easier to understand if you showed the effect of
the various ld commands (rather than the cc line that requests it).

In particular the 'interesting' output  (for ELF) the is contents
of the 'Dynamic Section' of the output file.
In particular the NEEDED, RPATH and SONAME fields.
This can be dislayed using 'objdump -p file'.

For instance:

$ objdump -p /usr/pkg/lib/

Dynamic Section:
RPATH       /usr/pkg/lib

When you specify a shared library to ld, the SONAME of the library
is put into a NEEDED entry of the output file.
The RPATH is used as an additional search path list when looking
for the libraries required by the file being built.
(So I'm not sure why it is being set to the directory containing
the library - I don't think it is automatically inherited by
programs (but may be wrong here).)

What happens on a given system (at load type) will be shown
by ldd - I think this runs the loader with some diagnostics
turned on?


David Laight: