FAQ
Hello,

I got a problem with multiple oracle client installations on a machine. We run an application which currently needs to
run with the Oracle 8.1.5 client libraries. Our Perl 5.6.1 DBD::Oracle was built against 8.1.6 libraries and I know that
it fails using the 8.1.5 libraries.

My problem currently is that we have to start a perl script being forked from an application which has LD_LIBRARY_PATH set
to use the 8.1.5 libraries. I wanted to modify the LD_LIBRARY_PATH variable in my perl script in the BEGIN block but it
does not work. I don't understand why it still looks for the 8.1.5 libraries. And breaks!

This is the flag from /opt/ivas/perl.5.6.1/lib/site_perl/5.6.1/sun4-solaris/auto/DBD/Oracle/mk.pm how it was built:
-L/opt/ivas/oracle/product/8.1.6/lib/

I recall reading in the DBI mailing list about being able to modify the LD_LIBRARY_PATH in the BEGIN block. Is this no
longer valid?

Thanks for any kind of help,

.kai

PS: The current workaround is wrapping this perl script in a shell script, which gives some additional overhead but
works. I would like to understand why the plain perl version does not work for me...

PPS: Here is some additional information
echo $LD_LIBRARY_PATH
/opt/ivas/oracle/product/8.1.5/lib:/usr/openwin/lib
/opt/ivas/noctools/bin/perl -MDBI -e 'print $DBI::VERSION' 1.21
/opt/ivas/noctools/bin/perl -MDBD::Oracle -e 'print $DBD::Oracle::VERSION' 1.12
cat test.pl
#!/opt/ivas/noctools/bin/perl -w

BEGIN {
$ENV{'ORACLE_HOME'} = "/opt/ivas/oracle/product/8.1.6";
$ENV{'LD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'} . "/lib";
}

use DBI;
use DBD::Oracle;

./test.pl
Can't load '/opt/ivas/perl.5.6.1/lib/site_perl/5.6.1/sun4-solaris/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: ld.so.1: /opt/ivas/noctools/bin/perl: fatal: relocation error: file /opt/ivas/perl.5.6.1/lib/site_perl/5.6.1/sun4-solaris/auto/DBD/Oracle/Oracle.so: symbol KI_DES8Strong: referenced symbol not found at /opt/ivas/perl.5.6.1/lib/5.6.1/sun4-solaris/DynaLoader.pm line 206.
at ./test.pl line 9
Compilation failed in require at ./test.pl line 9.
BEGIN failed--compilation aborted at ./test.pl line 9
truss -e -t open test.pl 2> /tmp/truss.out
cat /tmp/truss.out
execve("test.pl", 0xFFBEFA24, 0xFFBEFA34) argc = 3

...

LD_LIBRARY_PATH=/opt/ivas/oracle/product/8.1.5/lib:/usr/openwin/lib
VERSION=8.1.5
MACHTYPE=sparc-sun-solaris
ORACLE_HOME=/opt/ivas/oracle/product/8.1.5 LOGNAME=ivas
OSTYPE=solaris

...

open("/var/ld/ld.config", O_RDONLY) Err#2 ENOENT
open("/opt/ivas/oracle/product/8.1.5/lib/libsocket.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libsocket.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libsocket.so.1", O_RDONLY) = 3
open("/opt/ivas/oracle/product/8.1.5/lib/libnsl.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libnsl.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libnsl.so.1", O_RDONLY) = 3
open("/opt/ivas/oracle/product/8.1.5/lib/libdl.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libdl.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libdl.so.1", O_RDONLY) = 3
open("/opt/ivas/oracle/product/8.1.5/lib/libm.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libm.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libm.so.1", O_RDONLY) = 3
open("/opt/ivas/oracle/product/8.1.5/lib/libc.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libc.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libc.so.1", O_RDONLY) = 3
open("/opt/ivas/oracle/product/8.1.5/lib/libmp.so.2", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libmp.so.2", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libmp.so.2", O_RDONLY) = 3
open("/usr/platform/SUNW,Ultra-Enterprise/lib/libc_psr.so.1", O_RDONLY) = 3
open64("test.pl", O_RDONLY) = 3
....
open64("/opt/ivas/perl.5.6.1/lib/5.6.1/DBI.pm", O_RDONLY) Err#2 ENOENT
open64("/opt/ivas/perl.5.6.1/lib/site_perl/5.6.1/sun4-solaris/DBI.pm", O_RDONLY) = 4
....
open("/opt/ivas/perl.5.6.1/lib/site_perl/5.6.1/sun4-solaris/auto/DBI/DBI.so", O_RDONLY) = 5
....
open64("/opt/ivas/perl.5.6.1/lib/5.6.1/sun4-solaris/DBD/Oracle.pm", O_RDONLY) Err#2 ENOENT
open64("/opt/ivas/perl.5.6.1/lib/5.6.1/DBD/Oracle.pm", O_RDONLY) Err#2 ENOENT
open64("/opt/ivas/perl.5.6.1/lib/site_perl/5.6.1/sun4-solaris/DBD/Oracle.pm", O_RDONLY) = 4
open("/opt/ivas/perl.5.6.1/lib/site_perl/5.6.1/sun4-solaris/auto/DBD/Oracle/Oracle.so", O_RDONLY) = 4

[ It should have looked for the 8.1.6 version here...]
open("/opt/ivas/oracle/product/8.1.5/lib/libclntsh.so.8.0", O_RDONLY) = 4

[ This will not work due to conflicting versions, would have worked with the first so being 8.1.6]
open("/opt/ivas/oracle/product/8.1.5/lib/libwtc8.so", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libwtc8.so", O_RDONLY) Err#2 ENOENT
open("/opt/ivas/oracle/product/8.1.6/lib/libwtc8.so", O_RDONLY) = 4

open("/opt/ivas/oracle/product/8.1.5/lib/libgen.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libgen.so.1", O_RDONLY) Err#2 ENOENT
open("/opt/ivas/oracle/product/8.1.6/lib/libgen.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libgen.so.1", O_RDONLY) = 4
open("/opt/ivas/oracle/product/8.1.5/lib/libsched.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libsched.so.1", O_RDONLY) Err#2 ENOENT
open("/opt/ivas/oracle/product/8.1.6/lib/libsched.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libsched.so.1", O_RDONLY) = 4
open("/opt/ivas/oracle/product/8.1.5/lib/libaio.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libaio.so.1", O_RDONLY) Err#2 ENOENT
open("/opt/ivas/oracle/product/8.1.6/lib/libaio.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libaio.so.1", O_RDONLY) = 4
open("/opt/ivas/oracle/product/8.1.5/lib/librt.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/librt.so.1", O_RDONLY) Err#2 ENOENT
open("/opt/ivas/oracle/product/8.1.6/lib/librt.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/librt.so.1", O_RDONLY) = 4
open("/opt/ivas/oracle/product/8.1.5/lib/libkstat.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libkstat.so.1", O_RDONLY) Err#2 ENOENT
open("/opt/ivas/oracle/product/8.1.6/lib/libkstat.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libkstat.so.1", O_RDONLY) = 4
open("/opt/ivas/oracle/product/8.1.5/lib/libthread.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/openwin/lib/libthread.so.1", O_RDONLY) Err#2 ENOENT
open("/opt/ivas/oracle/product/8.1.6/lib/libthread.so.1", O_RDONLY) Err#2 ENOENT
open("/usr/lib/libthread.so.1", O_RDONLY) = 4
open64("/opt/ivas/perl.5.6.1/lib/5.6.1/sun4-solaris/Carp/Heavy.pm", O_RDONLY) Err#2 ENOENT
open64("/opt/ivas/perl.5.6.1/lib/5.6.1/Carp/Heavy.pm", O_RDONLY) = 4


--
Kai Jendrian (mailto:kai@jendrian.de) - http://www.jendrian.de

Search Discussions

  • Tim Bunce at Aug 14, 2002 at 9:55 am

    On Tue, Aug 13, 2002 at 04:18:58PM -0400, Kai Jendrian wrote:

    BEGIN {
    $ENV{'ORACLE_HOME'} = "/opt/ivas/oracle/product/8.1.6";
    $ENV{'LD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'} . "/lib";
    }
    Setting LD_LIBRARY_PATH after the program has started will not
    affect that program. It's too late by then.

    Tim.
  • Steve Sapovits at Aug 14, 2002 at 10:27 am

    Kai Jendrian wrote:

    BEGIN {
    $ENV{'ORACLE_HOME'} = "/opt/ivas/oracle/product/8.1.6";
    $ENV{'LD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'} . "/lib";
    }
    And Tim said:

    Setting LD_LIBRARY_PATH after the program has started will not
    affect that program. It's too late by then.

    One way around this, if you don't mind your program restarting on its
    own, is to do this. I believe it was someone on this list who pointed
    out this one to me:

    BEGIN
    {
    if (!defined($ENV{'ORACLE_HOME'}))
    {
    $ENV{'ORACLE_HOME'} = "/opt/ivas/oracle/product/8.1.6";
    $ENV{'LD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'} . "/lib";
    exec($^X, $0, @ARGV);
    }
    }

    --
    Steve Sapovits
    sapovitss@gsicommerce.com
  • Kai Jendrian at Aug 14, 2002 at 12:41 pm
    Hello,

    thanks for providing the answers!
    Setting LD_LIBRARY_PATH after the program has started will not
    affect that program. It's too late by then.
    One way around this, if you don't mind your program restarting on its
    own, is to do this. I believe it was someone on this list who pointed
    out this one to me:
    BEGIN
    {
    if (!defined($ENV{'ORACLE_HOME'}))
    {
    $ENV{'ORACLE_HOME'} = "/opt/ivas/oracle/product/8.1.6";
    $ENV{'LD_LIBRARY_PATH'} = $ENV{'ORACLE_HOME'} . "/lib";
    exec($^X, $0, @ARGV);
    }
    }
    This sounds like an iteresting option which adds some additional
    overhead to the solution I had figured with the shell script but it
    gets rid of maintaining a second file with code. Good point!

    Thanks a lot,
    .kai

    --
    Kai Jendrian (mailto:kai@jendrian.de) -- http://www.jendrian.de
  • Steve Sapovits at Aug 14, 2002 at 1:08 pm

    Kai Jendrian wrote:


    This sounds like an iteresting option which adds some additional
    overhead to the solution I had figured with the shell script but it
    gets rid of maintaining a second file with code. Good point!

    Overhead should be the same: A shell script is just one type of
    process starting the Perl program; versus a Perl process restarting
    itself. If you force the user to set the environment variables, you
    can start directly without any front end environment setter and then
    you save time. That's bad practice IMO -- we don't need to set
    environment variables to run commands that come with the system. It's
    okay to allow environment variables to control things and provide
    defaults. That's different than *requiring* them to be set.

    One other step I often take with Perl is to write a separate Env
    package associated with each package that needs default settings.
    That way, a Perl user can use @INC to pick up their own Perl package
    instead of the default I install.

    --
    Steve Sapovits
    sapovitss@gsicommerce.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedAug 13, '02 at 8:19p
activeAug 14, '02 at 1:08p
posts5
users3
websitedbi.perl.org

People

Translate

site design / logo © 2022 Grokbase