Subject: Re: phantom X11 lib
To: None <franklin@elfie.org, port-alpha@netbsd.org>
From: Ross Harvey <ross@ghs.com>
List: port-alpha
Date: 06/09/1999 22:40:48
> From: John Franklin <franklin@elfie.org>
>:::
> elfie# ./xosview 
> Shared object "libX11.so.6" not found
>:::

Ok, good investigation. You covered just about every base, except for one
thing that would probably have required reading a lot of source:  the loader
ignores the environment variable for setuid programs, and I suppose xosview
is setuid.

But note that if you make your xterm setuid, it will STILL find that library.
That's because xterm is linked with the magic ELF -rpath directive.

You need to do:
	$ cc  -Wl,-rpath,/usr/X11R6/lib  xosview.o ...

(The reason it doesn't default-in any directory it used while linking, is
because that's actually not the most common case. Typically, we link out
of a master build directory or distribution build target, and usually aren't
installing to / but to the build target dir. Anyway, that's how the ELF
tools work out of the box.)

These days, the NetBSD Package System does a pretty good job of dealing
with ELFness, but your 1.3.3 system was from much earlier days.

The NetBSD/alpha faq contains a discussion of exactly this issue, although
the section is a bit misnamed.  ("I made a shared library and my programs
can't find it" should probably be "My program can't find a shared library".)

	Ross.Harvey@Computer.org