On Thu, Jan 19, 2006 at 12:00:19PM +0100, Honza Pazdziora wrote:
> On Wed, Jan 18, 2006 at 11:29:10AM +0000, Tim Bunce wrote:
> > Here's a hopefully-final-stake-in-the-ground:
> > 
> >     http://www.data-plan.com/public/DBD-Oracle-1.17-RC5.tar.gz
> > 
> > As usual I'd be grateful for more, and wider, testing.
> 
> [...]
> 
> >   Changes to Makefile.PL:
> >     Instant Client support thanks to Hilmar Lapp, John Scoles and others.
> 
> The Instant Client compilation still seems broken on FC4, where
> Instant Client is installed via (provided by Oracle) .rpm. I have
> 
>       $ rpm -qa | grep instantclient
>       oracle-instantclient-basic-10.2.0.1-1
>       oracle-instantclient-sqlplus-10.2.0.1-1
>       oracle-instantclient-devel-10.2.0.1-1

Life would be easier for us if I could install that myself, but
        $ sudo yum install oracle-instantclient-basic-10.2.0.1-1.i386.rpm
says
         ...
        Installing:
         oracle-instantclient-basic  i386       10.2.0.1-1 
oracle-instantclient-basic-10.2.0.1-1.i386.rpm   95 M
         ...
        Is this ok [y/N]: y
        Downloading Packages:
        unsigned package oracle-instantclient-basic-10.2.0.1-1.i386.rpm
and
        $ rpm --install oracle-instantclient-basic-10.2.0.1-1.i386.rpm 
says
        error: can't create transaction lock on /var/lib/rpm/__db.000

I'm not very familar with linux or rpms. What am I doing wrong?
(Please answer off-list, thanks.)

> which puts header files to /usr/include/oracle/10.2.0.1/client, while
> having .so's in /usr/lib/oracle/10.2.0.1/client/lib.
> 
> As this Instant Client does not have ORACLE_HOME in the proper sense
> of that name, I use ORACLE_HOME pointing to the client/lib
> subdirectory. The Instant Client is correctly detected
> 
>       $ ORACLE_HOME=/usr/lib/oracle/10.2.0.1/client/lib perl Makefile.PL
> 
>       Using Oracle in /usr/lib/oracle/10.2.0.1/client/lib
>       DEFINE _SQLPLUS_RELEASE = "1002000100" (CHAR)
>       Oracle version 10.2.0.1 (10.2)
>       Looks like an Instant Client installation, okay
>       Your LD_LIBRARY_PATH env var is set to ''
>       Your LD_LIBRARY_PATH env var doesn't include 
> '/usr/lib/oracle/10.2.0.1/client/lib' but probably needs to.
>       Oracle sysliblist:
>       Your Instant Client installation doesn't have the SDK component 
> installed
> 
> but the find_headers is not called in this path, so that "find include
> directory for Instant Client code" is never used.
> 
> I propose the following patch. Note that with the .rpm intallation,
> the sdk/include directory is never there, so it does not make sense to
> put it into $opts{INC}, running find_headers instead makes the
> compilation and make test fly.
> 
> --- Makefile.PL.orig    2006-01-19 11:45:08.000000000 +0100
> +++ Makefile.PL 2006-01-19 11:49:09.000000000 +0100
> @@ -330,9 +330,14 @@
>      $opts{LIBS} = [ "-L$OH -l$lib $syslibs" ];
> 
>      my $inc = "$OH/sdk/include";
> -    warn "Your Instant Client installation doesn't have the SDK component 
> installed\n"
> -        unless -d $inc;
> -    $opts{INC}  = "-I$inc -I$dbi_arch_dir";
> +    if (-d $inc) {
> +        $opts{INC}  = "-I$inc -I$dbi_arch_dir";
> +    } else {
> +        warn "Your Instant Client installation doesn't have the SDK 
> component installed\n";
> +        my @h_dirs = find_headers();
> +        my $inc = join " ", map { "-I$_" } @h_dirs;
> +        $opts{INC}  = "$inc -I$dbi_arch_dir";
> +    }

How about the attached? It adds $OH/sdk/include into the search path
for find_headers() so the overall code is simpler. (It also fixes a
version number dependency that's always bugged me.)

Tim.

Index: Makefile.PL
===================================================================
--- Makefile.PL (revision 2428)
+++ Makefile.PL (working copy)
@@ -143,7 +143,7 @@
 } unless (-d $OH and $os eq 'VMS')
       or -d "$OH/sdk/."        # Instant Client with SDK
       or -d "$OH/lib/."        # normal Oracle installation
-      or -e "$OH/libclntsh.$so.10.1" # pre-sdk instant client XXX hack 
(version specific)
+      or glob("$OH/libclntsh.$so*") # pre-sdk instant client or rpm
       or -e "$OH/oci.dll";     # Windows Instant Client
  
 print "Using Oracle in $OH\n";
@@ -329,11 +329,8 @@
     $linkwith_msg = "-l$lib.";
     $opts{LIBS} = [ "-L$OH -l$lib $syslibs" ];
 
-    my $inc = "$OH/sdk/include";
-    warn "Your Instant Client installation doesn't have the SDK component 
installed\n"
-        unless -d $inc;
-    $opts{INC}  = "-I$inc -I$dbi_arch_dir";
-
+    my $inc = join " ", map { "-I$_" } find_headers();
+    $opts{INC}  = "$inc -I$dbi_arch_dir";
 }
 
 elsif ($mkfile = find_mkfile() and $mkfile =~ /\bdemo_xe.mk$/) { # Oracle XE
@@ -1370,7 +1367,9 @@
        "$OH/rdbms/public", # prefer public over others
        "$OH/rdbms",
        "$OH/plsql", # oratypes.h sometimes here (eg HPUX 11.23 Itanium Oracle 
9.2.0),
-       # --- Oracle Instant Client locations
+       # --- Oracle SDK Instant Client locations
+       "$OH/sdk/include",
+       # --- Oracle RPM Instant Client locations
        "/usr/include/oracle/$client_version_full/client", # Instant Client for 
RedHat FC4
        "/usr/include/oracle/$client_version_trim/client", # Instant Client for 
RedHat FC4
        "/include/oracle/$client_version_full/client", # Instant Client for 
RedHat FC3

Reply via email to