Hi,
We upgraded Oracle from 8.1.6 to 9.2.0.5 and I tried to rebuild the
DBD::Oracle module but it threw errors like:
.
gcc: unrecognized option `-q64'
ld: 0711-736 ERROR: Input file /lib/crt0_64.o:
XCOFF64 object files are not allowed in 32-bit mode.
collect2: ld returned 8 exit status
make: 1254-004 The error code from the last command is 1.
Stop.
After some digging I found out that this is because the machine is AIX 5.2
running under 32-bit and it is looking at the oracle's lib directory which
has 64 bit libraries. So after running "perl Makefile.PL", I edited the
Makefile
1. changing the references to Oracle's ../lib to ../lib32,
2. changing change crt0_64.o to crt0_r.o.
3. Remove the -q32 and/or -q64 options from the list of libraries to link
with.
Now when I ran "make" it went smoothly, so did make test and make install.
I ran my own simple perl testfile which connects to the Oracle and gets
some info and it works fine.
Now I have an application which can be customised to call perl scripts and
when I call this test script from that application it fails with:
install_driver(Oracle) failed: Can't load
'/usr/local/perl/lib/site_perl/5.8.5/a
ix/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: 0509-022 Cannot
load mod
ule /usr/local/perl/lib/site_perl/5.8.5/aix/auto/DBD/Oracle/Oracle.so.
0509-150 Dependent module
/u00/oracle/product/9.2.0/lib/libclntsh.a(sh
r.o) could not be loaded.
0509-103 The module has an invalid magic number.
0509-022 Cannot load module
/u00/oracle/product/9.2.0/lib/libclntsh.a.
0509-150 Dependent module
/u00/oracle/product/9.2.0/lib/libclntsh.a co
uld not be loaded. at /usr/local/perl/lib/5.8.5/aix/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
at /opt/dscmdevc/src/udps/test_oracle_dbd.pl line 45
whats happening here is that the application sets its own LIBPATH to
include oracle's lib(instead of lib32) in the beginning and that makes
perl look at the wrong place for the file - libclntsh.a .Unfortunately it
will take too long for the application developers to change this in their
application and I am looking for a quick solution. The test script is
something like:
use Env;
use strict;
use lib qw( /opt/harvest/common/perl/lib ) ;
#use lib qw( $ORACLE_HOME/lib32 ) ;
use DBI;
my $connect_string="dbi:Oracle:";
my $datasource="d1ach2";
$ENV{'LIBPATH'} = "${ORACLE_HOME}/lib32:$ENV{'LIBPATH'}" ;
.
.
my $dbh = DBI->connect($connect_string, $dbuser, $dbpwd)
or die "Can't connect to $datasource: $DBI::errstr";
.
.
Adding 'use lib' or using'$ENV{LIBPATH}' to change the LIBPATH is not
working because I need to make this work in this perl script and the "use
DBI" is run (or whatever the term is) in the compile-phase before the
LIBPATH is set in the run-phase.
I have a work around for it: write a wrapper ksh script which exports the
LIBPATH and then calls the perl script which works fine but I was
wondering if there is a way to set the libpath or do something else inside
the current perl script so that it knows where to look for the right
library files inspite of the wrong LIBPATH?
Or did I miss something when I changed the Makefile and did not install
everything right? Is there anyway I check this? (the make install didnot
throw any errors)
Any help or thoughts on this would be much appreciated.
Thanks!
Rachana.