Subject: Re: dynamic linking
To: Lucio De Re <lucio@proxima.alt.za>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-userlevel
Date: 03/19/2003 10:55:18
On Wed, 19 Mar 2003, Lucio De Re wrote:
> On Wed, Mar 19, 2003 at 09:22:01AM -0600, Frederick Bruckman wrote:
> > >
> > > -Wl,-R ld/gcc option adds the convenient hint entry into the resulting
> > > binary. Usually you will prefer the later solution, but then you have to
> > > modify the clinking options to add the correct one.
> >
> > A simpler way is to set LD_RUN_PATH in the build environment. That
> > only works, however, if there are no "Wl,-R" or "-Wl,-rpath" options
> > at all.
> >
> Fixing it is of course a priority, but I'm curious as to why it
> doesn't work out of the box. Shall I post the compilation output?
> I didn't notice anything out of place in it, so I'm baffled as I'd
> expect no such problem from such a trivial exercise.
You mean why the source doesn't adequately support gcc and ELF out of
the box? Many packages now do, but many still don't. Most linux
distributions include an ld.so.conf which lists a jumble of all the
likely places you might find a shared library, so they can mostly get
away with that.
Note that the global search paths defeat a really neat feature of ELF.
With embedded RPATH's, you can install different versions of a binary
with its shared libraries into different heirarchies, and each binary
gets the right libraries at run-time.
> PS: rdesktop _is_ in the 'pkg' collection, but I was in a hurry to
> use the most recent release, so I used the released version (1.2.0).
> It's probably a little thing in the configuration that's inconsistent
> with NetBSD's way of doing things...
Examinination of the NetBSD package shows that we've patched the
package to respect ${LDFLAGS}, and all NetBSD packages have "-Wl,-R"
options added to ${LDFLAGS} in the configure and build environments.
The ${LD_RUN_PATH} would work just as well. (The reason the package
system settled on "-Wl,-R" is that it works on NetBSD/a.out, too.)
Frederick