Subject: Re: phantom X11 lib
To: Ross Harvey <ross@ghs.com>
From: John Franklin <franklin@elfie.org>
List: port-alpha
Date: 06/10/1999 02:18:15
On Wed, Jun 09, 1999 at 10:40:48PM -0700, Ross Harvey wrote:
>> 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

Thank you.

> 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.

It's setgid, actually: needs to be in group kmem.

> 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.

I'm pretty sure I've built other things that use shared libraries and
don't run into this.  I suppose xosview is one of the few programs
that bothers to micromanage its libraries?

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

That did it.  Thanks for the tip.  (I think you meant 
-rpath=/usr/X11R6/lib, BTW.)

> 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.

That was the other thing that was bothering me.  A NetBSD-1.4/mac68k
system built and ran it just fine (well, after I added -DUVM to the 
CXXFLAGS.)

Oh, for those keeping score, xosview-1.7.0 froze the mac68k-1.4 system
(three-finger didn't work, but reset switch did), but 1.7.1 works fine.
Good that 1.7.1 fixed it, bad that a userland (albeit kmem-mucking)
program can kill a 1.4 system.

When I get a chance, I'll try to find the diff between 1.7.0 and 1.7.1
that killed it.

> 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".)

I read that some time ago when I was looking for another problem.  I think
the LD_LIBRARY_PATH fixed that one, which is why I was stumped when it
didn't work on this one.

jf
-- 
John Franklin
franklin@elfie.org
ICBM: N37 12'54", W80 27'14" Z+2100'