DBD-Oracle

 view release on metacpan or  search on metacpan

lib/DBD/Oracle/Troubleshooting/Hpux.pod  view on Meta::CPAN


=head3 Host

   HP-UX hostname B.11.11 U 9000/800 XXXXXXXXX unlimited-user license

=head3 Oracle

   Oracle 8.1.7

=head3 Parameters to build Perl

   ./Configure -des -Uinstallusrbinperl -Uusethreads -Uuseithreads
   -Duselargefiles -Dcc=gcc -Darchname=PA-RISC1.1 -Dprefix=/opt/perl-non-thread
   -Dlibs='-lcl -lpthread -L${ORACLE_HOME}/JRE/lib/PA_RISC/native_threads
   -ljava -lnsl -lnm -lndbm -ldld -lm -lc -lndir -lcrypt -lsec'

-L${ORACLE_HOME}/JRE/lib/PA_RISC/native_threads -ljava, was added
because DBD::Oracle wants to link with it (probably due to Oracle's own
build rules picked up by Makefile.PL)

Set environment variable LDOPTS to '+s' (see ld(1)). This holds extra
parameters to HP-UX's ld command, as I don't use GNU ld (does anybody?).
This allows you to build an executable, which when run would search for
dynamic linked libraries using SHLIB_PATH (for 32-bit executable) and
LD_LIBRARY_PATH (for 64-bit executable). Obviously LDOPTS is needed only
when building Perl _and_ DBI + DBD::Oracle.

Then, after building Perl + DBI + DBD::Oracle and moving it into
production environment it was enough to add to SHLIB_PATH
${ORACLE_HOME}/lib and ${ORACLE_HOME}/JRE/lib/PA_RISC/native_threads,
for example:

SHLIB_PATH=${ORACLE_HOME}/lib:${ORACLE_HOME}/JRE/lib/PA_RISC/native_threads:
$SHLIB_PATH

Please note output of ldd command:

   $ ldd -s ./perl
    [...]
     find library=/home/ora817/JRE/lib/PA_RISC/native_threads/libjava.sl;
   required by ./perl
       search path=/home/ora817/lib:/home/ora817/JRE/lib/PA_RISC/native_threads
   (SHLIB_PATH)
       trying path=/home/ora817/lib/libjava.sl
       trying path=/home/ora817/JRE/lib/PA_RISC/native_threads/libjava.sl
           /home/ora817/JRE/lib/PA_RISC/native_threads/libjava.sl =>
   /home/ora817/JRE/lib/PA_RISC/native_threads/libjava.sl
    [...]

All of this mess is necessary because of weakness of shl_load(3X),
explained in this document and in some discussion forums at HP.com
site. I have learned, that HP issued patch PHSS_24304 for HP-UX 11.11
and PHSS_24303 for HP-UX 11.00, which introduced variable LD_PRELOAD.
I haven't tried it yet, but it seems promising that it would allow you
to completely avoid building your own Perl binary, as it would be enough
to set LD_PRELOAD to libjava.sl (for example) and all
'Cannot load XXXlibrary' during building of DBD::Oracle should be gone.

The documentation says, that setting this variable should have the same
effect as linking binary with this library. Also please note, that this
variable is used only when binary is not setuid nor setgid binary (for
obvious security reasons).

It seems, that the best way to find out if you already have this patch
applied, is to check if 'man 5 dld.sl' says anything about LD_PRELOAD
environment variable.

Best regards,

Waldemar Zurowski

Authors Note:  Search for references to LD_PRELOAD else where in this
document.  Using LD_PRELOAD is probably a fragile solution at best.
Better to do what Waldemar actually did, which is to include libjava in
the extra link options.

=head2 Appendix B

(64 bit build with /usr/bin/cc -- bundled C compiler)

Gram M. Ludlow writes:

I recently had a problem with Oracle 9 64-bit on HPUX 11i. We have
another application that required SH_LIBRARY_PATH to point to the 64-bit
libraries, which "broke" the Oraperl module. So I did some research and
successfully recompiled and re-installed with the most recent versions of
everything (perl, DBI, DBD) that works with 64-bit shared libraries. This
is the error we were getting (basically)
"/usr/lib/dld.sl: Bad magic number for shared library:
/ora1/app/oracle/product/9.2.0.1.0/lib32"

Here is my step-by-step instructions, pretty much what you have but
streamlined for this particular case.

Required software:

   HPUX 11.11 (11i) PA-RISC
   perl 5.8.4 source
   DBI-1.42 source
   DBD-Oracle-1.16 source
   Oracle 9.2.0.1.0 installation

=over

=item Step 1: Compiling Perl

This compiles PERL using the default HPUX cc compiler. The important
things to note here are the configure parameters. the only non-default
option to take is to add "+z" to the additional cc flags step.

   gunzip perl-5.8.4.tar.gz
   tar -xf perl-5.8.4.tar
   cd perl-5.8.4
   ./Configure -Ubincompat5005 -Duselargefiles -A prepend:libswanted='cl pthread ' -Duse64bitall

Any additional cc flags?
Add +z to beginning of list, include all other options.

   make; make test

98% of tests should succeed. If less, something is wrong.



( run in 0.531 second using v1.01-cache-2.11-cpan-5735350b133 )