Subject: Re: static vs. dynamic runtime linking, again (was: PAM and su -K)
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Greywolf <greywolf@starwolf.com>
List: tech-userlevel
Date: 01/24/2005 15:49:31
[Thus spake der Mouse ("dM: ") 6:17pm...]

dM: I just ran into one myself, just yesterday.

I haven't read farther than this reply yet, so forgive me if my
reply is duplicated.

dM: I was dealing with a new 2.0 install.  I tried to link an X program.
dM: The linker couldn't find -lXext -lX11.  So I added -L/usr/X11R6/lib
dM: (from relatively hazy memory) and it found them - and promptly fell
dM: over when I tried to run it, saying it couldn't find some libXext.so
dM: file.

You need -Wl,-R/usr/X11R6/lib.  -L only (attempts to) resolve symbols
missing at link time; the -Wl,-R (which used to work fine with -R but
doesn't anymore) specifies the run-time path.

Yet another pain for dynamic-ness, but I'm okay with it.  MY main
objection is forcing me to go dynamic on the root fs.  I don't want
it, and my call is that "making static linking go away" is just bad
mojo.

I'll expound on this later.

dM: But I consider it catastrophically broken for a link to succeed and
dM: then executing the resulting binary, with no intevening changes such as
dM: library files disappearing, to fail for a reason that's wholly
dM: predictable at link time.  (It's fine to be able to cross-link and
dM: such, or to link for a system that has the .so files in other places.
dM: But that should be the unusual case.)

Such is, unfortunately, the dualism of a dynamically linked environment.

				--*greywolf;
--
Are you being infected by a UNIX virus?  If you're receiving OS shipments
from your vendor, you may be subjecting your computer to the worst virus
in history: SVR4.  There is a cure for this virus:  upgrade to NetBSD
(now running on a platform near you).