PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Katherine Marsden <marsden at sybase dot com>
Subject: perl and LD_LIBRARY_PATH
Date: Dec 12 1997 9:46PM

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.

See below for more gory details.


Thanks

Kathey Marsden


------------- Begin Forwarded Message -------------

>From pcjr@teapot Fri Dec 12 12:47 PST 1997
Date: Fri, 12 Dec 1997 12:44:03 -0800
From: pcjr@teapot (Peter Costantinidis)
To: marsden
Subject: perl and LD_LIBRARY_PATH

I believe that the sybperl module uses the DynaLoader.pm module.
This module has an internal variable named "dl_library_path" that
it uses as its library path.  This value is initialized with
information from the "Config.pm" module (the libpth variable).
Then, the value of LD_LIBRARY_PATH is appended.

I have set "LD_LIBRARY_PATH" within a "BEGIN" block.  Turning on
DynaLoader debugging (i.e. setting the "PERL_DL_DEBUG" env. var.)
reveals that "dl_library_path" is getting initialized so that it
includes the "/usr/local/system10/lib" entry.  However, it still
fails to find "libsybdb.so":

----- ----- ----- ----- -----
DynaLoader.pm loaded (/usr/local/lib/perl5/sun4-solaris/5.002
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/sun4-solaris
/usr/local/lib/perl5/site_perl ., /usr/local/lib
/opt/gnu/lib /lib /usr/lib /usr/ccs/lib /lib /usr/lib
/usr/X11/lib/X11/XKeysymDB
/usr/local/system10/lib)
DynaLoader::bootstrap for Sybase::DBlib (auto/Sybase/DBlib/DBlib.so)
Can't load
'/usr/local/lib/perl5/site_perl/sun4-solaris/auto/Sybase/DBlib/DBlib.so'
for module
Sybase::DBlib: ld.so.1: /usr/local/bin/perl: fatal: libsybdb.so: can't
open file: errno=2 at
/usr/local/lib/perl5/DynaLoader.pm line 140.

 at /usr/local/lib/perl5/site_perl/Sybase/DBlib.pm line 304
BEGIN failed--compilation aborted at dbconnect.pl line 32.
----- ----- ----- ----- -----

If all I change is to set "LD_LIBRARY_PATH" in the environment, it
works:

----- ----- ----- ----- -----
$ dbconnect.pl
DynaLoader.pm loaded (/usr/local/lib/perl5/sun4-solaris/5.002
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/sun4-solaris
/usr/local/lib/perl5/site_perl ., /usr/local/lib
/opt/gnu/lib /lib /usr/lib /usr/ccs/lib /lib /usr/lib
/usr/X11/lib/X11/XKeysymDB
/usr/local/system10/lib /usr/local/system10/lib)
DynaLoader::bootstrap for Sybase::DBlib (auto/Sybase/DBlib/DBlib.so)
CA
----- ----- ----- ----- -----

I tried modifying the "libpth" variable in "Config.pm", this had no
effect:
----- ----- ----- ----- -----
$ dbconnect.pl
DynaLoader.pm loaded (/usr/local/lib/perl5/sun4-solaris/5.002
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/sun4-solaris
/usr/local/lib/perl5/site_perl ., /usr/local/lib
/opt/gnu/lib /lib /usr/lib /usr/ccs/lib /usr/local/system10/lib /lib
/usr/lib
/usr/X11/lib/X11/XKeysymDB /usr/local/system10/lib)
DynaLoader::bootstrap for Sybase::DBlib (auto/Sybase/DBlib/DBlib.so)
Can't load
'/usr/local/lib/perl5/site_perl/sun4-solaris/auto/Sybase/DBlib/DBlib.so'
for module
Sybase::DBlib: ld.so.1: /usr/local/bin/perl: fatal: libsybdb.so: can't
open file: errno=2 at
/usr/local/lib/perl5/DynaLoader.pm line 140.

 at /usr/local/lib/perl5/site_perl/Sybase/DBlib.pm line 304
BEGIN failed--compilation aborted at dbconnect.pl line 32.
----- ----- ----- ----- -----

I suspect that "dl_library_path" is used by perl to find the shared
objects
that it explicitly loads.  The shared objects that get loaded by the
newly
loaded shared object use the old mechanism that consults
LD_LIBRARY_PATH.
And, since setting $ENV{LD_LIBRARY_PATH} has no effect the environment
of
the currently executing process, we won't get anywhere manipulating it.

...pc
------------- End Forwarded Message -------------