develooper Front page | perl.dbi.users | Postings from March 2008

Library not found errors with DBD-Oracle-1.20

Thread Next
From:
James H. McCullars
Date:
March 18, 2008 11:10
Subject:
Library not found errors with DBD-Oracle-1.20
Hi, I have successfully installed the Oracle instant client, 
DBI-1.602 and DBD-Oracle 1.20 and can connect to a database on a 
remote host, but only if I set LD_LIBRARY_PATH to the directory where 
the instant client is installed.  This is fine, but I need to do this 
from a CGI script, and setting the environment there does not 
work.  I know that there is a way to do this in Apache using a SetEnv 
statement, but I would prefer not to do that.  The problem is, the 
library should be found.  The message that is being logged is this:

install_driver(Oracle) failed: Can't load 
'/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris/auto/DBD/Oracle/Oracle.so' 
for module DBD::Oracle: ld.so.1: perl: fatal: libnnz10.so: open 
failed: No such file or directory at 
/usr/local/lib/perl5/5.8.7/sun4-solaris/DynaLoader.pm line 230.
  at (eval 3) line 3
Compilation failed in require at (eval 3) line 3.
Perhaps a required shared library or dll isn't installed where expected

If I set ORACLE_HOME and LD_LIBRARY_PATH before doing the perl 
Makefile.PL and the make, then Oracle.so gets compiled like this:

LD_RUN_PATH="/usr/local/pkg/oracle-instant-client/instantclient_10_2" 
gcc  -G -L/usr/local/lib Oracle.o dbdimp.o oci8.o  -o 
blib/arch/auto/DBD/Oracle/Oracle.so 
-L/usr/local/pkg/oracle-instantclient/instantclient_10_2 -lclntsh

I then unset LD_LIBRARY_PATH and do an ldd command on Oracle.so, and 
it cannot find libnnz10.so:

bash-2.05$ ldd blib/arch/auto/DBD/Oracle/Oracle.so
         libclntsh.so.10.1 
=> 
/usr/local/pkg/oracle-instant-client/instantclient_10_2/libclntsh.so.10.1
         libc.so.1 =>     /usr/lib/libc.so.1
         libnnz10.so =>   (file not found)
         libkstat.so.1 =>         /usr/lib/libkstat.so.1
         libnsl.so.1 =>   /usr/lib/libnsl.so.1
         libsocket.so.1 =>        /usr/lib/libsocket.so.1
         libgen.so.1 =>   /usr/lib/libgen.so.1
         libdl.so.1 =>    /usr/lib/libdl.so.1
         libsched.so.1 =>         /usr/lib/libsched.so.1
         libaio.so.1 =>   /usr/lib/libaio.so.1
         librt.so.1 =>    /usr/lib/librt.so.1
         libm.so.1 =>     /usr/lib/libm.so.1
         libmp.so.2 =>    /usr/lib/libmp.so.2
         libmd5.so.1 =>   /usr/lib/libmd5.so.1
         /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
         /usr/platform/SUNW,UltraAX-i2/lib/libmd5_psr.so.1

Even if I manually recompile Oracle.so adding a -R parameter with the 
location of the Oracle libraries, it the ldd command will not locate 
the library:

bash-2.05$ gcc  -G -L/usr/local/lib Oracle.o dbdimp.o oci8.o  -o 
blib/arch/auto/DBD/Oracle/Oracle.so
-L/usr/local/pkg/oracle-instant-client/instantclient_10_2
-R/usr/local/pkg/oracle-instant-client/instantclient_10_2 -lclntsh
bash-2.05$ ldd 
blib/arch/auto/DBD/Oracle/Oracle.so 
libclntsh.so.10.1 
=> 
/usr/local/pkg/oracle-instant-client/instantclient_10_2/libclntsh.so.10.1
         libc.so.1 =>     /usr/lib/libc.so.1
         libnnz10.so =>   (file not found)
         libkstat.so.1 =>         /usr/lib/libkstat.so.1
         libnsl.so.1 =>   /usr/lib/libnsl.so.1
         libsocket.so.1 =>        /usr/lib/libsocket.so.1
         libgen.so.1 =>   /usr/lib/libgen.so.1
         libdl.so.1 =>    /usr/lib/libdl.so.1
         libsched.so.1 =>         /usr/lib/libsched.so.1
         libaio.so.1 =>   /usr/lib/libaio.so.1
         librt.so.1 =>    /usr/lib/librt.so.1
         libm.so.1 =>     /usr/lib/libm.so.1
         libmp.so.2 =>    /usr/lib/libmp.so.2
         libmd5.so.1 =>   /usr/lib/libmd5.so.1
         /usr/platform/SUNW,UltraAX-i2/lib/libc_psr.so.1
         /usr/platform/SUNW,UltraAX-i2/lib/libmd5_psr.so.1

But the file is definitely there:

bash-2.05$ ls -la 
/usr/local/pkg/oracle-instant-client/instantclient_10_2/libnnz10.so
-rwxr-xr-x   1 jim      100      6135928 Dec 20  2006 
/usr/local/pkg/oracle-instant-client/instantclient_10_2/libnnz10.so

Does anyone have any idea why the library file is not being found at 
runtime without LD_LIBRARY_PATH?  It almost seems as if once the 
oracle-install-client directory is searced once, it will not search 
it again.  I know there are possible workarounds (like symlinking all 
those files to /usr/lib, or maybe setting the environment in Apache), 
but I would prefer to get this working with as few system changes as 
possible.  This is Solaris 9 and gcc 3.1.  Thanks...

Jim McCullars
University of Alabama in Huntsville


Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About