Subject: Re: xorg and shared libraries
To: Jeremy C. Reed <reed@reedmedia.net>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: netbsd-users
Date: 01/07/2005 16:35:30
In message <Pine.LNX.4.43.0501070909260.27246-100000@pilchuck.reedmedia.net>, "
Jeremy C. Reed" writes:

>
>Maybe it is just certain tools that are missing the RPATH that should list
>your /usr/pkg/xorg/lib. Maybe do the above objdump to look at RPATH of all
>your /usr/pkg/xorg/bin/ executables.
>

Life just got a lot more complicated....  

Since I was dealing with a new, fast machine, I wiped out /usr/pkg
and /var/db/pkg, and started over again.  I installed xorg from
scratch.  X is now working; RPATH is defined for most executables in
/usr/pkg/xorg/bin; all of them list /usr/pkg/xorg/lib.  (The ones that
don't list it are pretty reasonable: imake, lndir, makedepend, makestrs ,
pswrap, revpath, rman.)

Worse yet, I went back to a machine on which I have both xorg and
XFree86 and found the same results.  But xterm and several other
apps were absolutely not working this morning on the second
machine.

What's the difference?  The first time around, I added about 250 packages
that I'd compiled on another machine on which I did install X11R6.  xorg
is near the end of the list when one says 'pkg_add *' -- did installing
something else first confuse matters?  Even deleting xorg and rebuilding
from scratch on the second machine didn't help, because there were
~240 other packages still installed.  I don't know nearly enough about
pkgsrc or ELF to even hazard a guess, but that's the only thing I can
think of that's different between the two attempts.

I will note one other point that's been mentioned in the discussion
but not as a focus: binary packages that use X need to be compiled
(or rather, linked) on a machine with the same X configuration.  I
check xfig -- a simple application by today's standards, in that it depends
on very few other packages -- and its RPATH indeed (and not surprisingly)
referenced /usr/X11R6/lib.  Nor did it run on the new machine when I installed
from the binary package I'd built on the first machine.  I don't see a
way around that problem other than a symlink hack or an ld.so.conf hack.
I've added tech-pkg to the cc list, since I think the latter is a
fairly fundamental package problem: what X directories do you include
in the RPATH when building portable binary packages?

Any other suggestions for what I should try before I bring that new
machine into service?  Looks like I have to recompile lots of
packages, unless someone can suggest an easy to figure out which
ones don't need X and hence are safe.  (Of course, almost without
exception the ones that don't need X are small and compile very
quickly.  Mozilla, OTOH, is painful even on a fast machine....)