Any GCC experts out there?

Harald Meland harald.meland at usit.uio.no
Mon Aug 25 10:54:41 BST 2008


[Reinhard Tartler]

> Russel Winder <russel.winder at concertant.com> writes:
>
>> Setting LD_LIBRARY_PATH=/usr/local/apr/lib does solve the problem but:
>>
>> a) setting LD_LIBRARY_PATH is generally considered the wrong thing to do
>> in all cases.
>
> Well, in the debian/linux community, it is generally considered "the
> wrong thing" to set rpath. The solaris community seems to suggest the
> opposite.

That's not my (limited) experience.  LD_LIBRARY_PATH is a big hammer
that can solve your problem, but if you can avoid having the problem
at all (and hence avoid having to solve it for every user/using a
wrapper script) then that's certainly better.

>> b) should not be needed since the compilation stage set -L and this
>> should have been remembered. in the shared object.
>
> Here is the subtle difference between gnu LD and the Solaris LD (gcc
> does not really matter here). When using Solaris' LD with -L it does
> pretty much the same as gnu LD's -rpath switch.

In my experience, Solaris's LD uses -R for the equivalent of GNU LD's
-rpath.  You can pass options from gcc to ld using gcc's "-Wl,foo"
option.

> Btw, as probably easier workaround, you can set an implicit -rpath
> value on the binary by setting LD_RUN_PATH at compilation time. See
> ld(1) (the gnu version) for details.

Setting LD_RUN_PATH should work with Solaris LD as well.
-- 
Harald



More information about the bazaar mailing list