DBD:: Oracle and LIBPATH problem for 32bit OS and 64 bit Oracle

From: Rachana Gaddam (rachana.gaddam_at_wachovia.com)
Date: 12/08/04


To: <dbi-users@perl.org>
Date: Wed, 8 Dec 2004 11:47:54 -0500

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.



Relevant Pages

  • SerialPort error
    ... I have a perl script that complains about not being able to find ... install Device::SerialPort ... Are permissions correct? ... Failed 1/21 tests, 95.24% okay ...
    (comp.lang.perl.modules)
  • Re: Help regarding Perl modules in .pl and .in extension.
    ... > I am having problems when referencing to modules that have the extension .pl ... are a Perl script and a template ... If the module you want doesn't come pre-packaged for windows, ... be hard to install. ...
    (comp.lang.perl.misc)
  • Re: Installing a CPAN Module online
    ... I think I should be able to write a Perl script to execute these commands, ... are thinking of writing and uploading a CGI script that would install the module for you. ... Even if that may be possible, under certain conditions, the first thing you should do is finding out if it's a plain Perl module, or a module that needs to be precompiled. ...
    (comp.lang.perl.modules)
  • Re: Any tool for network/bandwidth testing "standard" Solaris 9?
    ... install any software/tools beyond what is normally available in a ... Solaris installation (no compilers available on the system, ... ISTR there are ways to "pipe" data to FTP for a put - you could then ... could in theory write a perl script to connect to one of those three ...
    (comp.unix.solaris)
  • "libc.so.6: version `GLIBC_2.4 not found" when running library on different machine
    ... a Perl script on my web page, which is hosted by another company. ... this, I downloaded GD, the libraries on which it depends, and the Perl ... The Perl script dies at line 12, which is the "use GD;" line. ... and I'm building my library on a machine with a newer glibc. ...
    (perl.beginners)