Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Problem with setting LD_LIBRARY_PATH

Reply
Thread Tools

Problem with setting LD_LIBRARY_PATH

 
 
Moritz Karbach
Guest
Posts: n/a
 
      04-21-2005
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
 
Reply With Quote
 
 
 
 
Steven Kuo
Guest
Posts: n/a
 
      04-21-2005
On Thu, 21 Apr 2005, Moritz Karbach wrote:

> 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


--
Hope this helps,
Steven

 
Reply With Quote
 
 
 
 
Moritz Karbach
Guest
Posts: n/a
 
      04-21-2005
Steven Kuo wrote:

> 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

 
Reply With Quote
 
Moritz Karbach
Guest
Posts: n/a
 
      04-21-2005
Steven Kuo wrote:

> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting LD_LIBRARY_PATH env variable for child process Lax Perl Misc 2 04-14-2007 07:27 AM
setting LD_LIBRARY_PATH through eclipse Spitfire Java 2 02-15-2007 12:22 PM
loading jvm (libjvm.so) and setting LD_LIBRARY_PATH Naresh Agarwal Java 0 06-30-2005 11:20 AM
$LD_LIBRARY_PATH, cx_Freeze and wxPython Simon John Python 2 09-19-2004 07:31 AM
Problem using LD_LIBRARY_PATH in perl script Christian Eriksson Perl 1 11-25-2003 05:53 PM



Advertisments