Hi!
On Wed, 12 Oct 2011 23:34:28 -0700, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Thu, 13 Oct 2011 08:12:03 +0200, dtk <dtk@gmx.de> wrote:
> > in my experience, it tends to cause awkward side effects that are hard to
> > debug, the main problem being that it overrides all default paths and is
> > hard to target at a single problematic application.
>
> I think it's fairly straightforward to prepend a library path to the ld
> library path without overriding all defaults with something like this
> (for bash):
>
> LD_LIBRARY_PATH=/new/ld/path:$LD_LIBRARY_PATH
This is in fact not safe, and may cause subtle issues: if LD_LIBRARY_PATH
is empty initally, it'll evaluate to:
LD_LIBRARY_PATH=/new/ld/path:
Of this one, the last element is empty, and ld.so will thus look into the
current directory for libc.so, for example. Now you cd /tmp/ and enter
ls... :-)
Or, as it once bit me, you're on a system with such an LD_LIBRARY_PATH
set (without me knowing about it). You do glibc development, and wonder
why some commands begin acting strangely when you're in the glibc build
directory...
Thus:
LD_LIBRARY_PATH=/new/ld/path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
Grüße,
Thomas