Subject: Re: static vs. dynamic runtime linking, again (was: PAM and su -K)
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Jachym Holecek <freza@liberouter.org>
List: tech-userlevel
Date: 01/25/2005 02:21:33
> >> At that point I added -static and the problems went away.  [...]
> > You forgot -Wl,-rpath,/usr/X11R6/lib --
> 
> "Forgot"?  Where was I supposed to remember it from?

I don't know. Sorry if my wording was bad; I only meant to provide a
datapoint.

> I didn't use LD_LIBRARY_PATH and /etc/ld.so.conf - though given
> NetBSD's much-trumpted commitment to backwards compatability, I
> certainly should have been able to.

And it would have worked (it did, last time I checked).

> I took a stock system and tried to
> link an X program.  I got an error because the libraries weren't found
> (which strikes me as severely broken; if I tell the installer to
> install the X compilation stuff, I shouldn't need any special options
> to build X stuff).  What kind of "repair" do you think I need to do?
> It looks to me as though the answer is "stop trying to use NetBSD,
> because it's too hostile towards code that hasn't been Blessed by the
> Build System Gurus", which I must admit is looking pretty tempting at
> this point.

No, this is just generic ELF dynamic linking behaviour, it could easily
happen on any ELF using system (but see below why it doesn't happen that
often on Linux).

By broken software packages I meant those that don't set dynamic linker
path, sometimes even when pointed to alternate library locations through
configuration time flag. At a time, I've been bitten by this on daily
basis -- but that was some years ago and maybe those packages were fixed
since then [this applies to next paragraph, too].

On Linux, such packages usually work despite their brokeness, because
entries pointing to ${whatever}/lib are often pre-set in /etc/ld.so.conf
But this and LD_LIBRARY_PATH are just hacks for backwards compatibility,
the ELF-correct way is setting dynamic linker path at compile time, AFAIU.

BTW, I find bsd.x11.mk quite useful for custom X11 software build.

> If I were a na?ve user without my long history with NetBSD, I would
> [... /usr/X11R6/bin not in PATH by default ...]

Ok, then it's a bug. Nothing more, nothing less.

	Regards,
		-- Jachym Holecek