Bug #56679 [Opn->Fbk]: PDO-OCI does not find headers from Instant Client ZIP install

From: Date: Mon, 03 May 2021 11:35:08 +0000
Subject: Bug #56679 [Opn->Fbk]: PDO-OCI does not find headers from Instant Client ZIP install
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233645@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=56679&edit=1

 ID:                 56679
 Updated by:         cmb@php.net
 Reported by:        cjbj at hotmail dot com
 Summary:            PDO-OCI does not find headers from Instant Client
                     ZIP install
-Status:             Open
+Status:             Feedback
 Type:               Bug
-Package:            PDO_OCI
+Package:            PDO OCI
 Operating System:   Max OSX, Linux
 PHP Version:        5_1 CVS-2005-11-28
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Is this still an issue with any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>


Previous Comments:
------------------------------------------------------------------------
[2010-01-13 06:02:34] j dot kaluza at redcross-transfusion dot be

I think this workaround should be inserted in the package if possible it's been old story
already and it's not in the downloadable package yet. Some students i know are stuck with that
problem. Actually the best solution would be a configure option that et the user specify where is
the oracle headers such as --with-oci-headers='/path/to/instantclient/headers'.
This kind of problem will occur everytime Oracle will change the directories structure :/

------------------------------------------------------------------------
[2006-11-12 12:17:27] chuck at horde dot org

Using PHP 5.2.0, also on MacOS, configure finishes successfully (it finds the libraries and
headers), but it doesn't add the oracle includes to the -I paths for compilation, so compile
bails out quickly not finding oci.h. The instantclient files are in /usr/local/oracle/instantclient,
with the .h files in /usr/local/oracle/instantclient/sdk/include.

(Even if I copy those files into an include directory that is checked the build fails, but
that's because the oracle libs aren't universal and I have an intel mac, which is
definitely not PHP's problem.)

------------------------------------------------------------------------
[2006-09-09 11:29:16] php-bugs at danslereseau dot com

This patch doesn't completely fix building with pdo-oci on Mac OS X:

checking for oci.h... ./instantclient10_1/sdk/include
configure: error: I'm too dumb to figure out where the libraries are in your instant client
install

It does fix the problem with finding the oci.h file, but it then check for a libclntsh.so file,
which is not included in the Mac OS X InstantClient ZIP file.
The test -f should use "libclntsh.$SHLIB_SUFFIX_NAME", not "libclntsh.so".

I also had to:
ln -s libclntsh.dylib.10.1 libclntsh.dylib
but I don't think that's related.

Without this last symlink, I was getting this error:

checking Oracle Instant Client version... configure: error: Link from
./instantclient10_1/libclntsh.dylib to libclntsh.dylib.10.1 not found

Finally, after those two errors were fixed, I was getting:

checking for oci.h... ./instantclient10_1/sdk/include
configure: error: Unsupported Oracle version! 

It seems the configure scripts tries to use directory names to guess the version of Oracle when
using InstantClient.
For Mac OS X, it should try to guess it using the filename of libclntsh.$SHLIB_SUFFIX_NAME.10.1

Here's a patch tested with Mac OS X 10.4 and InstantClient 10.1 (ZIP files).

*** ext/pdo_oci/config.m4.orig        Wed Feb 15 21:03:13 2006
--- ext/pdo_oci/config.m4       Sat Sep  9 11:27:59 2006
***************
*** 96,111 ****
      else
        AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your instant
client install])
      fi
!     if test -f "$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib/libclntsh.so"
; then
        PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib"
!     elif test -f "$PDO_OCI_IC_PREFIX/client/lib/libclntsh.so" ; then
        PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/client/lib"
!     elif test -f "$PDO_OCI_IC_PREFIX/libclntsh.so" ; then
        PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX"
      else
        AC_MSG_ERROR([I'm too dumb to figure out where the libraries are in your instant client
install])
      fi
-     PDO_OCI_VERSION="echo $PDO_OCI_IC_VERS | cut -d. -f1-2"
    else
      if test -d "$PDO_OCI_DIR/rdbms/public"; then
        PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/public)
--- 96,120 ----
      else
        AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your instant
client install])
      fi
!     PDO_OCI_VERSION="echo $PDO_OCI_IC_VERS | cut -d. -f1-2"
!     if test -f
"$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib/libclntsh.$SHLIB_SUFFIX_NAME" ;
then
        PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib"
!     elif test -f "$PDO_OCI_IC_PREFIX/client/lib/libclntsh.$SHLIB_SUFFIX_NAME" ; then
        PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/client/lib"
!     elif test -f "$PDO_OCI_IC_PREFIX/libclntsh.$SHLIB_SUFFIX_NAME" ; then
        PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX"
+       if test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
+         PDO_OCI_VERSION=10.1
+       elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
+         PDO_OCI_VERSION=9.0
+       elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.8.0; then
+         PDO_OCI_VERSION=8.1
+       elif test -f $PDO_OCI_LIB_DIR/libclntsh.$SHLIB_SUFFIX_NAME.1.0; then
+         PDO_OCI_VERSION=8.0
+       fi
      else
        AC_MSG_ERROR([I'm too dumb to figure out where the libraries are in your instant client
install])
      fi
    else
      if test -d "$PDO_OCI_DIR/rdbms/public"; then
        PHP_ADD_INCLUDE($PDO_OCI_DIR/rdbms/public)

------------------------------------------------------------------------
[2005-11-29 22:20:05] wez@php.net

Fixed in CVS:
http://viewcvs.php.net/viewcvs.cgi/php-src/ext/pdo_oci/config.m4.diff?r1=1.14.2.2&r2=1.14.2.3

------------------------------------------------------------------------
[2005-11-28 21:37:02] cjbj at hotmail dot com

Description:
------------
Configure fails without finding the Oracle Instant Client headers.
See http://forums.oracle.com/forums/thread.jspa?threadID=343352
for a
user occurrence of this problem on Mac OSX:

  ./configure --with-pdo-oci=instantclient,/usr/local/oracle/instantclient10_1/,10.1.0.3

  Error:
  checking for oci.h... configure: error: I'm too dumb to figure out
  where the include dir is in your instant client install

An Instant Client install from the ZIPs puts the libs in
instantclient10_1 or instantclient_10_2 and the headers in
instantclient10_1/sdk/include or instantclient_10_2/sdk/include.

(For an Instant Client RPM install, the oracle libs will be in /usr/lib and the headers will be in
/usr/include,
e.g. /usr/include/oracle/10.2.0.1/client/oci.h)

Here's a temporary patch.  It has been tested only with 10.2 ZIP
install on Linux.

--- config.m4.orig	2005-09-25 10:30:44.000000000 +1000
+++ config.m4	2005-11-29 13:08:29.287748520 +1100
@@ -61,10 +61,19 @@
     elif test -f $PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include/oci.h ; then
       PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
       AC_MSG_RESULT($PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/include)
+    elif test -f $PDO_OCI_IC_PREFIX/sdk/include/oci.h ; then
+      PHP_ADD_INCLUDE($PDO_OCI_IC_PREFIX/sdk/include)
+      AC_MSG_RESULT($PDO_OCI_IC_PREFIX/sdk/include)
     else
       AC_MSG_ERROR([I'm too dumb to figure out where the include dir is in your instant client
install])
     fi
-    PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib"
+    if test -f "$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib/libclntsh.so";
then
+      PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX/lib/oracle/$PDO_OCI_IC_VERS/client/lib"
+    elif test -f "$PDO_OCI_IC_PREFIX/libclntsh.so"; then
+      PDO_OCI_LIB_DIR="$PDO_OCI_IC_PREFIX"
+    else
+      AC_MSG_ERROR([I'm too dumb to figure out where the libraries are in your instant client
install])
+    fi
     PDO_OCI_VERSION="echo $PDO_OCI_IC_VERS | cut -d. -f1-2"
   else
     if test -d "$PDO_OCI_DIR/rdbms/public"; then

After applying this patch, remove "configure" and 
autom4te.cache, and then run buildconf



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=56679&edit=1


Thread (1 message)

  • cmb@php.net
  • Unknown Message
    • cmb@php.net
« previous php.bugs (#233645) next »