On 2010-05-31 15:52:21 +0200, Peter J. Holzer wrote: > On Linux (at least i386[1]) the loader uses the current value of > LD_LIBRARY_PATH when it is asked to load an .so file. So you can change > LD_LIBRARY_PATH just before you want to load the library. > > On Solaris the loader uses the value of LD_LIBRARY_PATH at program > startup. Changing LD_LIBRARY_PATH during runtime has no effect on the > process itself, just its children. I don't know why this is the case, > but I guess that LD_LIBRARY_PATH is split into components when the first > library (probably libc) and after that the components aren't used any > more. > > hp > > > [1] I seem to remember that I ran into problems either on x86_64 or on > power, but I don't remember the details. If it's x86_64, I should be > able to test it (don't have access to power-based systems any more).
Just for the record: That problem does exist on Linux/x86_64. I just ran into the issue moving a bunch of CGI scripts from a Linux/i386 box to a Linux/x86_64 box. They do something like: if (open(E, "$offl_root/dbi/env")) { while (<E>) { chomp; my ($k, $v) = split(/=/); $ENV{$k} = $v; printlog('DEBUG', "setting $k=$v"); } } my ($data_source, $username, $auth) = read_cred("$offl_root/dbi/usradm"); my $dbh; eval { $dbh = DBI->connect($data_source, $username, $auth, { AutoCommit => 0, PrintError => 1, RaiseError => 1 } ); }; if ($@) { ... } where $offl_root/dbi/env contains several environment variables, among them ORACLE_HOME and LD_LIBRARY_PATH. On Linux/i386 this works fine. On Linux/x86_64 it fails with the error message connection to dbi:Oracle:wpdb.wsr.ac.at as usradm failed: install_driver(Oracle) failed: Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libocci.so.10.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230. despite the fact that libocci.so.10.1 is in the LD_LIBRARY_PATH. If I set LD_LIBRARY_PATH in the Apache config, it works as expected. So I conclude that Linux/x86_64, like Solaris, but unlike Linux/i386, ignores changes to LD_LIBRARY_PATH after a program is started. hp -- _ | Peter J. Holzer | Auf jedem Computer sollte der Satz Ludwigs II |_|_) | Sysadmin WSR | eingeprägt stehen: "Ein ewig Rätsel will ich | | | h...@wsr.ac.at | bleiben, mir und andern." __/ | http://www.hjp.at/ | -- Wolfram Heinrich in desd
signature.asc
Description: Digital signature