Auto-rpath revisited...

Lee Iverson leei@AI.SRI.COM
Sat Feb 21 14:20:00 GMT 1998


In message < ork9aohj6w.fsf@iguacu.dcc.unicamp.br > you write:
> Ian Lance Taylor writes:
> 
> >    I'd suggest that the library path for libraries that gcc/g++ chooses
> >    to link in automatically should be inserted automatically too.  This
> >    would cover a quite common case of linking against several shared
> >    libraries whose run-time directories you happen to know about with
> >    libstdc++: you don't have to know where it lives, and it is
> >    transparently linked in, so it should be transparently found at
> >    run-time.
> 
> > I continue to feel that if the user explicitly specifies a -R or
> > -rpath option, you should trust them.
> 
> > I would find it rather frustrating to want to set the rpath, and have
> > gcc override me because it thought it knew better.
> 
> This is ok when you know what you're doing.  But most users don't know
> g++ links -lstdc++ in, they just expect g++ to do the Right Thing
> (TM).  *You* know what you're doing and what g++ will do, so you'll
> just run gcc ... -R... -lstdc++, or g++ -nostdlib ... -lstdc++, which
> will work.
> 
> I was just worried about C++ programs that rely on libtool libraries:
> libtool would specify -rpath, but it wouldn't know where libstdc++
> was, so that specification would be missing.  But then, if g++ did
> implicitly append libstdc++ to the library path, it should implicitly
> append its runtime directory too.

Fruitful discussion.  Two points:

1) I forgot to mention that collect2 shouldn't and doesn't add
   relative paths to the auto-rpath.  The only difficulty with this is
   testing before install, but the LD_LIBRARY_PATH management by
   recent releases of dejagnu seems to be the right way to manage
   this, I believe.

2) I agree with Alexandre, and respond to Ian by suggesting that I add
   an option that turns off the auto-rpath behaviour for the
   sophisticated user who is actually managing this properly.  As it
   currently stands, the implementation searches user-supplied rpath
   entries *before* searching the -L paths and adds needed directories
   onto the *end* of the user-supplied rpath.
   
   If you really are an Ian Taylor, specifying a complete rpath will
   thus obviate the need to add anything to the rpath.  Beyond that, I
   would expect it to be exceedingly unusual for a user to
   deliberately want to leave a shared library unresolved by the
   rpath.

-------------------------------------------------------------------------------
Lee Iverson     		SRI International
leei@ai.sri.com			333 Ravenswood Ave., Menlo Park CA 94025
http://www.ai.sri.com/~leei/	(650) 859-3307



More information about the Gcc mailing list