Operating System - Linux
1829759 Members
21574 Online
109992 Solutions
New Discussion

Dynamic loader search paths on HP-UX 11i

 
marko asplund
Frequent Advisor

Dynamic loader search paths on HP-UX 11i

Hi

My question is related to building the Perl Oracle access module (DBD::Oracle) module with the Oracle Instant Client but since my problem concerns the HP-UX 11i linker and dynamic loader search paths in general I'm posting it here.

I'm trying to figure out how to build DBD::Oracle 1.16 with Oracle Instant Client 10gR2 on HP-UX 11i (PA-RISC). Instant client is an Oracle client library that consists of shared libraries (search paths in the library files are broken) and include files. Building the DBD::Oracle module shared library (Oracle.sl) with Instant Client goes fine but when I try to run a program using that module I get the following error:

nebbiolo% /opt/kronodoc/perl/kb3402dr7/bin/perl ~/dbi-test.pl
install_driver(Oracle) failed: Can't load '/opt/kronodoc/perl/kb3402dr7/lib/site_perl/5.8.6/PA-RISC2.0-LP64/auto/DBD/Oracle/Oracle.sl' for module DBD::Oracle: No such file or directory at /opt/kronodoc/perl/kb3402dr7/lib/5.8.6/PA-RISC2.0-LP64/DynaLoader.pm line 230.
at (eval 1) line 3
Compilation failed in require at (eval 1) line 3.
Perhaps a required shared library or dll isn't installed where expected
at /home/aspa/dbi-test.pl line 19

When I run the same program with the LD_LIBRARY_PATH set everything goes fine:

nebbiolo% env LD_LIBRARY_PATH=/opt/kronodoc/oracle10g/instantclient_10_2/lib /op
t/kronodoc/perl/kb3402dr7/bin/perl ~/dbi-test.pl
dbh: DBI::db=HASH(0x800000010013d9e8)

I'd like to build the Instant Client library search path into the DBD::Oracle module or Perl binary itself to avoid having to set any extra environment variables, however.

Here's how the DBD::Oracle shared library gets linked:

/usr/bin/ld +b "/opt/kronodoc/oracle10g/instantclient_10_2/lib" -b +vnocompatwarnings -L/usr/local/lib -L/lib/pa20_64 Oracle.o dbdimp.o oci8.o -o blib/arch/auto/DBD/Oracle/Oracle.sl -L/opt/kronodoc/oracle10g/instantclient_10_2/lib -lclntsh -lnnz10 -lociei

Here's what ldd says about the DBD::Oracle shared library I've built:

nebbiolo% ldd blib/arch/auto/DBD/Oracle/Oracle.sl
libclntsh.sl.10.1 => /opt/kronodoc/oracle10g/instantclient_10_2/lib/libclntsh.sl.10.1
libnnz10.sl => /opt/kronodoc/oracle10g/instantclient_10_2/lib/libnnz10.sl
libociei.sl => /opt/kronodoc/oracle10g/instantclient_10_2/lib/libociei.sl
Unable to find library 'libnnz10.sl'.

What would be the best way to embed the shared library search path either into the DBD::Oracle shared library or the Perl binary itself? Are there any other solutions which don't involve setting environment variables at run-time?


br. aspa
5 REPLIES 5
Stephen Keane
Honored Contributor

Re: Dynamic loader search paths on HP-UX 11i

You can try -Wl,+b/usr/lib

changing /usr/lib to whatever path you want.


marko asplund
Frequent Advisor

Re: Dynamic loader search paths on HP-UX 11i

The +b linker option is there on the above command line:

/usr/bin/ld +b "/opt/kronodoc/oracle10g/instantclient_10_2/lib" -b +vnocompatwarnings -L/usr/local/lib -L/lib/pa20_64 Oracle.o dbdimp.o oci8.o -o blib/arch/auto/DBD/Oracle/Oracle.sl -L/opt/kronodoc/oracle10g/instantclient_10_2/lib -lclntsh -lnnz10 -lociei

I don't understand why libnnz10.sl is listed twice when I check the list of linked libraries for Oracle.sl. With the first occurrence the linker finds the library but fails to find the second occurence.

br. aspa
Stephen Keane
Honored Contributor

Re: Dynamic loader search paths on HP-UX 11i

'libnnz10.sl' will be listed twice if it is linked into the executable directky AND is linked into one of the shared libraries linked into your executable. The +b option should also be applied to any shared libraries that link in other (non-HP) shared libraries too.
marko asplund
Frequent Advisor

Re: Dynamic loader search paths on HP-UX 11i

The library dependencies in this case are the following:
- Perl depends on Oracle.sl (DBD::Oracle driver)
- Oracle.sl is linked with libclntsh.sl (libnnz10.sl and libociei.sl can be linked in)
- libclntsh.sl apparently depends on libnnz10.sl and libociei.sl

I'm free to do any necessary build process modifications for Perl and Oracle.sl but the Oracle libraries (libclntsh.sl, libnnz10.sl and libociei.sl) are provided by Oracle and I don't have the source code for them.

Is adding the correct library search path to all the libraries including all the Oracle provided libraries required? Can I somehow modify or add a search path to the Oracle libraries?


aspa
Fabio Ettore
Honored Contributor

Re: Dynamic loader search paths on HP-UX 11i

Hi Marko,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=929331

check posts of Alex Glennie.

HTH.

Best regards,
Fabio
WISH? IMPROVEMENT!