[sf-perl] Setting LD_LIBRARY_PATH

Steve Fink sphink at gmail.com
Fri Jul 6 10:12:40 PDT 2007


On 7/6/07, Quinn Weaver <quinn at fairpath.com> wrote:
> On Thu, Jul 05, 2007 at 03:33:59PM -0700, Loo, Peter # PHX wrote:
> > Hello All,
> >
> > Unix admins here are not happy about updating the .profile of the
> > production account to add two additional entries to LD_LIBRARY_PATH
> > environment variable.  So I am having to figure out an alternative
> > solution in setting this environment dynamically during program run.
>
> Hi, Peter,
>
> I think your Unix admins are being unreasonable--this sounds like a global
> setting for all Perl programs, which is exactly the kind of thing
> that should go in .profile.

I think I'd lean towards siding with the admins -- yes, it's a global
setting, but:

 1. .profile should be used sparingly, because it's far too easy to
dump things in there and tweak how stuff works (eg overriding binaries
by putting something in the front of $PATH), but then having things
mysteriously behave differently when you're trying to replicate your
system on another box. Modifying it becomes part of the installation
of a dozen different packages, and an easy-to-forget and
easy-to-screw-up part as well (if you install twice, do you update it
twice? If two packages both modify LD_LIBRARY_PATH, will they
overwrite each other's changes? etc.)

2. LD_LIBRARY_PATH itself is a nasty hacky thing to depend on. I'm
very glad it exists, but I try to only use it when testing uninstalled
things. Because it's a nasty hacky thing, it also tends to get
stripped out of the environment to avoid security problems, eg when
running under sudo or as a setuid program.

I think you want to make a system-wide change as specific to what
you're trying to achieve as possible. In this case, then if you're on
a Linux box then I think that would mean adding your paths to
/etc/ld.so.conf (and rerunning ldconfig? not sure).

I could have just said that in the first place without getting
pedantic, I suppose.

The even better-er option would be to install whatever it is within a
lib dir already in the library search path, but I recognize that there
all kinds of reasons why that may not work out for your particular
case.


More information about the SanFrancisco-pm mailing list