|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at mbay dot net>
Subject: Re: perl and LD_LIBRARY_PATH
Date: Dec 12 1997 10:43PM
Katherine Marsden wrote:
>
> Hi:
>
> I am getting an error loading libsybdb.so when I use
> the Sybperl module.
>
> If I add the location of this file (/usr/local/system10/lib)
> to my LD_LIBRARY_PATH environmental variable, it works.
> I want to avoid this as a requirement for my users,
> so would like to do something like.
>
> $ENV{LD_LIBRARY_PATH} .= "/usr/local/system10/lib:$ENV{LD_LIBRARY_PATH};
>
> use Sybase::DBlib;
>
> This does not work. How can I have my perl script make this
> addition to LD_LIBRARY_PATH before loading sybase.
The short answer is that it can't.
It is not possible to set LD_LIBRARY_PATH to affect a running process.
You can only affect processes that will be created from this process.
So one solution is to write a small shell wrapper that sets
LD_LIBRARY_PATH before exec'ing the perl script.
Another (untested) solution would be to do something like:
#!/usr/local/bin/perl
BEGIN {
if($ENV{LD_LIBRARY_PATH} !~ /sybase/) {
$ENV{LD_LIBRARY_PATH} .= ":/usr/local/sybase/lib";
exec $0, @ARGV;
}
}
use Sybase::DBlib;
etc...
which might work.
However, it is normally not necessary to have LD_LIBRARY_PATH set
if sybperl is built correctly, unless you move the binary to a new
machine/environement where the Sybase libraries are in a different
location.
BTW this has nothing to do with perl's DynaLoader. It's ld.so
that does the dynamic loading of the Sybase libraries. The DynaLoader
loads the DBlib.so glue code.
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@datamig.com -||- http://www.mbay.net/~mpeppler
|