Subject: Re: X library path, etc.
To: Peter Seebach <seebs@plethora.net>
From: Todd Vierling <tv@wasabisystems.com>
List: current-users
Date: 01/15/2002 08:52:46
On Mon, 14 Jan 2002, Peter Seebach wrote:

: It is a frequent nuisance to me that any program that is linked with
: X11 libs seems to need "-Wl,-R/usr/X11R6/lib".
:
: Couldn't/shouldn't the default be that "-Lfoo" *IMPLIES* that?  Is there
: some obvious trick I'm missing that would make a naive build script work
: by default, without having to tell it "by the way, you need to go out of
: your way to clarify that you weren't joking when you asked for the X11 libs"?

This is how ELF does things:  linking != runtime linking, and thus, they use
completely separate lists of paths.

In fact, there's three sets of link paths, which do different things:

-L             list of paths to find libraries for -l at link time

-rpath or -R   list of paths to find libraries at runtime

-rpath-link    list of paths to find libraries that are uninstalled
               dependencies of -l libraries (not used at runtime)

In order to ensure that the rpath list is not polluted by things like
/usr/pkgsrc/foo/bar/work.i386/bar-1.0/src/bleh, the default is for ld(1) NOT
to add anything to rpath unless explicitly specified.  This is the same for
other ELF systems.

You have the option to add /usr/X11R6/lib to /etc/ld.so.conf; that
capability was added to ld.elf_so specifically for people like you who are
stuck with third-party code that does not know how to do things correctly in
the ELF world (and doesn't use something sane like xmkmf to pick up proper
defaults).

However, we don't specify any search paths in ld.so.conf, because that
increases path searches and the possibility of name clashes, as noted
before.  Instead, all packages made for the base system or pkgsrc use rpath
properly, and it's left to you to choose the options that help you compile
third-party source by hand.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  Wasabi & NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/