in reply to Re: Set LD_LIBRARY_PATH and restart program (improvements)
in thread Set LD_LIBRARY_PATH and restart program

In my case, I do want it to overwrite the path, because the 'default' environment "they" have picked for us has a bunch of crap in LD_LIBRARY_PATH, and I want shared lib paths to default to the path that the other shared libs were compiled under, not get overridden by LD_LIBRARY_PATH.

E.g., (On Solaris) I've compiled a new libxml2 in a non-standard place, and compiled XML::LibXML against that new version. With LD_LIBRARY_PATH unset, it finds the right libxml2. If I leave LD_LIBRARY_PATH set, it finds the old version and complains. I've tried adding '-i' to the LDDLFLAGS when compiling XML::LibXML to try and say 'ignore LD_LIBRARY_PATH' (-R/path was already being used), but it doesn't seem to work, so this is my BandAid(tm).

And it seems to work ok without the "env" (though if this were a universal portable solution, I'd put it in).

Oh, and if you want to add paths instead of overwrite it, I'm sure you could just pass the current value of LD_LIBRARY_PATH in to the import list along with other paths.

Update: AFAICT, my main issue seems to be that "they" decided to put "/usr/lib" in LD_LIBRARY_PATH, which, if my recent research has led me to a correct conclusion, is a bad bad thing.

  • Comment on Re^2: Set LD_LIBRARY_PATH and restart program (improvements)