Problem with setting LD_LIBRARY_PATH

M

Moritz Karbach

Hi experts,

I'd like to run a program out of a perl script. The program needs a special
library path, which I'd very much like to set inside the perl script. Here
is what I tried:

--- perl script ---

#!/usr/bin/perl -w
$ENV{'LD_LIBRARY_PATH'} .= ":" . `pwd`;
exec 'ldd', 'fplist';


--- output ---
....
libreadline.so.4 => /lib/libreadline.so.4 (0x40a9a000)
....


That is, the fplist program still uses the system library instead of using
the one in the working directory. It works, if I do it completely on the
shell:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
$ ldd fplist
....
libreadline.so.4 =>
/afs/desy.de/user/m/mkarbach/h1/grid/h1mcjobwrapper/libreadline.so.4
(0x40a9a000)
....


Can anybody tell me, what the problem is?

Thanks,

- Moritz
 
S

Steven Kuo

Hi experts,

I'd like to run a program out of a perl script. The program needs a special
library path, which I'd very much like to set inside the perl script. Here
is what I tried:

--- perl script ---

#!/usr/bin/perl -w
$ENV{'LD_LIBRARY_PATH'} .= ":" . `pwd`;



Forgot that the output from `pwd` includes newline at the end?


exec 'ldd', 'fplist';


--- output ---
...
libreadline.so.4 => /lib/libreadline.so.4 (0x40a9a000)
...


That is, the fplist program still uses the system library instead of using
the one in the working directory. It works, if I do it completely on the
shell:

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`
$ ldd fplist
...
libreadline.so.4 =>
/afs/desy.de/user/m/mkarbach/h1/grid/h1mcjobwrapper/libreadline.so.4
(0x40a9a000)
...


Can anybody tell me, what the problem is?


See perldoc -f chomp
and perldoc -f qx
 
M

Moritz Karbach

Steven said:
Forgot that the output from `pwd` includes newline at the end?

Aaaarrg! That was exactly the problem! So f** simple! And I spent hours in
googling before I asked here...

Thanks a lot,

- Moritz
 
M

Moritz Karbach

Steven said:
Forgot that the output from `pwd` includes newline at the end?

Aaaarrg! That was exactly the problem! So f** simple! And I spent hours in
googling before I asked here...

Thanks a lot,

- Moritz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top