Home > Archive > Oracle PERL DBD > September 2005 > [svn:dbd-oracle] r1538 - dbd-oracle/branches/pythian









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [svn:dbd-oracle] r1538 - dbd-oracle/branches/pythian
byterock@cvs.perl.org

2005-09-30, 1:24 pm

Author: byterock
Date: Fri Sep 30 08:12:11 2005
New Revision: 1538

Modified:
dbd-oracle/branches/pythian/Makefile.PL
dbd-oracle/branches/pythian/README.linux
Log:
New Makefile.pl and lunix.readme for support of oracle instantclient


Modified: dbd-oracle/branches/pythian/Makefile.PL
====================
====================
====================
==================
--- dbd-oracle/branches/pythian/Makefile.PL (original)
+++ dbd-oracle/branches/pythian/Makefile.PL Fri Sep 30 08:12:11 2005
@@ -5,11 +5,13 @@
## September 20 2005
## scoles@pythian.com
## changes made
-## Added a new option flag '-ic10' which will
-## do the code under its if statment
-## it look for the the lib files at <$OH/lib*>
-## it set the inc dir as follows $inc = "-I$OH\/sdk/include";
-## and removes the if stament for other oracle versions
+## Removed option flag '-ic10'.
+## Added a new elsif block that searches for libclntsh.so.10.1 file on the path $HO
+## In this block it sets a link to libclntsh.so.10.1 as libclntsh.so
+## then hard codes the lib to clntsh and then carries on.
+## I attempted to hardcode libclntsh.so.10.1 for clntsh but this does not
+## not work. It seems that others are getting this same form of error as well
+## i.e. The compiler does not recognize .10.1 as a lib

# vim: ts=8:sw=4

@@ -85,7 +87,6 @@ my %mk_target_rules;

# Options (rarely needed)
# to turn off an option prefix with 'no', ie 'perl Makefile.PL -nob'
-$::opt_ic10 = 1; # Build for Oracle 10g instantclient
$::opt_b = 1; # try to use Oracle's own 'build' rule
$::opt_r = ''; # With -b above, use this names build rule (eg -r=build64)
$::opt_m = 0; # path to proc.mk or oracle.mk file to read
@@ -108,7 +109,7 @@ $::opt_V = 0; # force assumption of sp
# and we force our emulation of OCILobWriteAppend

Getopt::Long::config
( qw( no_ignore_case ) );
-GetOptions(qw(b! r=s v! d! g! p! l! c! f! F! W! w! ic10! m=s n=s s=s S=s V=s ProC!))
+GetOptions(qw(b! r=s v! d! g! p! l! c! f! F! W! w! m=s n=s s=s S=s V=s ProC!))
or die "Invalid arguments";

$::opt_g &&= '-g'; # convert to actual string
@@ -150,9 +151,9 @@ die qq{ The $ORACLE_ENV environment var
on this machine (or a machine with a compatible architecture)
See the README.clients file for more information.
ABORTED!
-} unless (($os eq 'VMS') ? -d $OH : -d "$OH/lib/.");
+} unless (($os eq 'VMS') ? -d $OH :(-e "$OH/libclntsh.so.10.1" ) ? 1 : -d "$OH/lib/.");

-#this unless supports the ora 10g client
+#the (-e "$OH/libclntsh.so.10.1" ) supports the 10 instantclient

die qq{ The $ORACLE_ENV environment variable value ($OH) is not valid.
It must be set to hold the path to an Oracle installation directory
@@ -314,28 +315,34 @@ elsif ($::opt_l and # use -l to enable t
}
# --- special case for Oracle 10g instant client

-elsif (($::opt_ic10) and # uses the -l direct-link approach as well
- @_=grep { m:/lib(cl(ie)?ntsh|oracle).\w+$:o } <$OH/lib*>
- ) {
+elsif (-e "$OH/libclntsh.so.10.1") {
+
+ #support for 10 instantclient
+ # John Scoles
# --- the simple modern way ---
- foreach(@_) { s:\Q$OH/lib/::g }
- print "Found direct-link candidates: @_\n";
- my $lib = ("@_" =~ m:lib(cl(ie)?ntsh)\.:) ? $1 : "oracle";
+
+ eval { symlink("$OH/libclntsh.so.10.1","$OH/libclntsh.so") };
+ # need to link so.10.1 file to .so
+ # hard coded the link dir here and below
+
+ print "Found direct-link candidate: clntsh\n";
+ my $lib = "clntsh";
my $syslibs = read_sysliblist();
+
print "Oracle sysliblist: $syslibs\n";
- my $libdir = ora_libdir();
+
+ # no library dir with instantclient
+ my $libdir = "";
+
$opts{dynamic_lib} = { OTHERLDFLAGS => "$::opt_g" };
+
$linkwith_msg = "-l$lib.";
- $opts{LIBS} = [ "-L$OH/$libdir -l$lib $syslibs" ];
-
+ $opts{LIBS} = [ "-L$OH/$libdir -l$lib $syslibs"];
my $inc = "-I$OH\/sdk/include";
-
$opts{INC} = "$inc -I$dbi_arch_dir";

- print "libs=$opts{LIBS}[0]\n";
}
else { # --- trawl the guts of Oracle's make files looking the how it wants to link
-
#Lincoln: pick the right library path
my $libdir = ora_libdir();
my @ora_libs = <$OH/$libdir/lib*>;
@@ -758,7 +765,6 @@ if ($opts{LINKTYPE} && $opts{LINKTYPE} e
# create this before WriteMakefile so MakeMaker knows it's here
open(MK_PM, ">mk.pm") or die "Unable to create mk.pm: $!";

-print "\n";
WriteMakefile( dbd_edit_mm_attribs(
\%opts) );

check_security() unless $os eq 'VMS' or $os eq 'MSWin32' or $os =~ /cygwin/i;
@@ -967,6 +973,7 @@ sub ora_libdir {
else {
$libdir = 'lib64' if perl_is_64bit() and -d "$OH/lib64";
}
+
return $libdir;
}

@@ -988,7 +995,6 @@ sub del_crtobj {


sub find_mkfile {
-
my @mkfiles;
my @mk_proc = (
'precomp/demo/proc/proc.mk',
@@ -1037,7 +1043,6 @@ sub find_mkfile {
} unless ($os eq 'MSWin32') || ($os eq 'VMS') || ($mkfile && -f $mkfile) || $::opt_F;

print "Using $mkfile\n";
-
warn "Note: Attempting to use makefile from otrace component. This may not work.\n"
if ($mkfile =~ /atmoci.mk/);

@@ -1333,7 +1338,7 @@ sub find_bin{
my $bin = shift;
my $path_sep = $Config{path_sep};
foreach (split(/\Q$path_sep/, $ENV{PATH})){
- return "$_/$bin" if -x "$_/$bin";
+ return "$_/$bin" if -x "$_/$bin";
}
return undef;
}
@@ -1341,7 +1346,8 @@ sub find_bin{

sub find_headers {
my (%h_dir, %h_file, @h_dir);
- find( sub {
+
+ find( sub {
return unless /^o(ci.{3,4}|ratypes)\.h$/i;
my $dir = $File::Find::dir;
$dir =~ s:^\Q$OH/::;
@@ -1350,15 +1356,17 @@ sub find_headers {
print "Found $dir/$_\n" if $::opt_d;
},
# --- Oracle Instant Client locations
- "$OH/sdk", # Instant Client default location (10g)
"/include/oracle/ $client_version_full
/client", # Instant Client for RedHat FC3
# --- Traditional full-install locations
"$OH/rdbms/public", # prefer public over others
"$OH/rdbms",
- "$OH/plsql", # oratypes.h sometimes here (eg HPUX 11.23 Itanium Oracle 9.2.0)
+ "$OH/plsql", # oratypes.h sometimes here (eg HPUX 11.23 Itanium Oracle 9.2.0),
);
+
@h_dir = keys %h_dir;
+
print "Found header files in @h_dir.\n" if @h_dir;
+
if (!$h_file{'oratypes.h'} || !$h_file{'ocidfn.h'}) {
print " \n\n****************
********************
********************
*\n";
print "I can't find the header files I need in your Oracle installation.\n";
@@ -1380,7 +1388,6 @@ sub get_client_version {
my $sqlplus_exe = ($os eq 'Win32') ? "sqlplus.exe" : "sqlplus";
local $ENV{PATH} = join $Config{path_sep}, $ENV{PATH}, "$OH/bin", $OH;
local $ENV{SQLPATH} = ""; # avoid $SQLPATH/login.sql causing sqlplus to hang
-
if (find_bin($sqlplus_e
xe)) {
# Try to use the _SQLPLUS_RELEASE predefined variable from sqlplus
# Documented in the SQL*Plus reference guide:

Modified: dbd-oracle/branches/pythian/README.linux
====================
====================
====================
==================
--- dbd-oracle/branches/pythian/README.linux (original)
+++ dbd-oracle/branches/pythian/README.linux Fri Sep 30 08:12:11 2005
@@ -49,21 +49,17 @@ smooth as just about every other CPAN mo
I don't know if Oracle is bulletproof on Linux but the install process
has some problems.

-From: John Scoles <scoles@pythian.com>
-Date: Thurs, 22 Sep 2005 07:00:00 -0600 (EST)
-Subject Oracle 10g Instantclient
-
-I have modified the Makefile.PL by adding a -ic10 option flag.
-This does the same action as a -l but looks for files in different dirs.
-I am working on a new Makefile.PL that auto-detects for the Instantclient
-Check out this thread
-http://www.cpanforum.com/threads/229
-at the cpan form as my new Makefile.PL incorporates the changes indicated in this thread.
-You may have to set some links as follows
-ln -s . lib
-ln -s libclntsh.so.10.1 libclntsh.so
-ln -s libocci.so.10.1 libocci.so
-depending where the Instantclient is installed.
-

+From: John Scoles <scoles@pythian.com>
+Date: Fri, 29 Sep 2005 10:48:47 -0700 (EST)
+Subject: RE: Oracle 10g Instantclient

+The Makefile.PL will now work for Oracle 10g Instantclient. To have both the Compile and
+the test.pl to work you must first have the LD_LIBRARY_PATH correctly set to your
+"instantclient" directory. (http://www.oracle.com/technology/te...tantclient.html)
+The present version of the make creates a link on your "instantclient" directory as follows
+"ln -s libclntsh.so.10.1 libclntsh.so". It is needed for both the makefile creation and the compile
+but is not need for the test.pl. It should be removed after the compile.
+If the Makefile.PL or make fails try creating this link directly in the ""instantclient" directory.
+
+"instantclient" as follows
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com