Subject: Re: static vs. dynamic runtime linking, again (was: PAM and su -K)
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Ben Collver <collver@peak.org>
List: tech-userlevel
Date: 01/24/2005 15:35:12
On Mon, Jan 24, 2005 at 06:17:31PM -0500, der Mouse wrote:
> > It's outright dislike and disgust of the clear and dramatic technical
> > consequences and measurable costs and overhead of dynamic linking.
> 
> I just ran into one myself, just yesterday.
> 
> I was dealing with a new 2.0 install.  I tried to link an X program.
> The linker couldn't find -lXext -lX11.  So I added -L/usr/X11R6/lib
> (from relatively hazy memory) and it found them - and promptly fell
> over when I tried to run it, saying it couldn't find some libXext.so
> file.
> 
> At that point I added -static and the problems went away.  Now, it's
> possible that my -L option was wrong, or insufficient, or something; I
> didn't bother trying to grovel thorugh the manpages to figure it out.
> 
> But I consider it catastrophically broken for a link to succeed and
> then executing the resulting binary, with no intevening changes such as
> library files disappearing, to fail for a reason that's wholly
> predictable at link time.  (It's fine to be able to cross-link and
> such, or to link for a system that has the .so files in other places.
> But that should be the unusual case.)

Ain't a bug, it's a feature:
http://www.netbsd.org/Documentation/software/compiling.html#elf-issue

Ben