Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

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 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:


   if($ENV{LD_LIBRARY_PATH} !~ /sybase/) {
	$ENV{LD_LIBRARY_PATH} .= ":/usr/local/sybase/lib";
         exec $0, @ARGV; 

use Sybase::DBlib;


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

BTW this has nothing to do with perl's DynaLoader. It's
that does the dynamic loading of the Sybase libraries. The DynaLoader
loads the glue code.

Michael Peppler       -||-  Data Migrations Inc.  -||-