On Mon, 4 Apr 2011, Robert Nesius wrote:

> On Mon, Apr 4, 2011 at 1:03 PM, Florin Iucha <florin at iucha.net> wrote:
>
>> On Mon, Apr 04, 2011 at 01:46:55PM -0400, dutchman_mn at charter.net wrote:
>>
>>> A coworker asked me a question and I could not give a definitive 
>>> answer. For a LD_LIBRARY_PATH entry, does Linux search sub-directories 
>>> recursively?  He is installing a database driver (Progress) on a 
>>> CentOS 5.3 and needs to point to some compat libraries.  However, they 
>>> are not in a single directory but in both a top-level directory such 
>>> as /usr/lib/progress but also in /usr/lib/progress/dirA and 
>>> /usr/lib/progress/dirB.  Would you have to point at all three 
>>> directories?
>>
>> Yes, you have to list all directories.  Just like with $PATH.
>
> You can also use symlink trees to create one location that has 
> references to all of your shared libraries, but I'd just set up 
> LD_LIBRARY_PATH correctly.  Don't mess with rpaths unless you don't want 
> flexibility or you need things to work irregardless of the user 
> environment. (rpaths only apply if you are building from source...).


I remember reading a few times that it was a bad idea to set 
LD_LIBRARY_PATH in the environment and that it was best to write a script 
to call the program and set LD_LIBRARY_PATH within the script.  This was 
probably where I read it:

http://xahlee.org/UnixResource_dir/_/ldpath.html

Here's the key excerpt with the part (#3) I seem to be remembering:


Canonical rules for handling LD_LIBRARY_PATH

1. Never ever set LD_LIBRARY_PATH globally.
2. If you must ship binaries that use shared libraries and want to allow
    your clients to install the program outside a 'standard' location, do
    one of the following:
      · Ship your binaries as .o files, and as part of the install process
        relink them with the correct installation library path.
      · Ship executables with a very long “dummy” run-time library path,
        and as part of the install process use a binary editor to
        substitute the correct install library path in the executable.
3. If you are forced to set LD_LIBRARY_PATH, do so only as part of a
    wrapper.


While looking for that, I also found this:

http://prefetch.net/articles/linkers.badldlibrary.html

Mike