Issue building cx_Oracle - libclntsh.so.11.1 => nicht gefunden

Ich versuche, cx_Oracle für eine Python 2.7.2- und Oracle 11g-Installation zu erstellen, aber die integrierte Datei cx_Oracle.so kann libclntsh.so.11.1 nicht finden, sodass der Import von cx_Oracle in Python fehlschlägt.

/mypath/cx_Oracle-5.1.1/build/lib.linux-x86_64-2.7-11g]$ ldd cx_Oracle.so
    libclntsh.so.11.1 => not found
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00002ae9be290000)
    libc.so.6 => /lib64/libc.so.6 (0x00002ae9be4ab000)
    /lib64/ld-linux-x86-64.so.2 (0x000000389b600000)

ich habelibclntsh.so.11.1 in meinem Oracle-Client-Installationsverzeichnis:

/apps/oracle/client/11.2.0.1/home1/lib]$ ls -l libclntsh.so*
libclntsh.so -> /apps/oracle/client/11.2.0.1/home1/lib/libclntsh.so.11.1
libclntsh.so.11.1

Und die cx_Oracle setup.py holt sich dieses Bibliotheksverzeichnis:

/mypath/cx_Oracle-5.1.1]$ python2.7 setup.py build
/apps/oracle/client/11.2.0.1/home1/
running build
running build_ext
building 'cx_Oracle' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/apps/oracle/client/11.2.0.1/home1/rdbms/demo -I/apps/oracle/client/11.2.0.1/home1/rdbms/public -I/apps/bweb/python-2.7.2/include/python2.7 -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.1.1
In file included from /apps/oracle/client/11.2.0.1/home1/rdbms/public/oci.h:3024,
                 from cx_Oracle.c:10:
/apps/oracle/client/11.2.0.1/home1/rdbms/public/ociap.h:10788: warning: function declaration isn't a prototype
/apps/oracle/client/11.2.0.1/home1/rdbms/public/ociap.h:10794: warning: function declaration isn't a prototype
gcc -pthread -shared build/temp.linux-x86_64-2.7-11g/cx_Oracle.o -L/apps/oracle/client/11.2.0.1/home1/lib -lclntsh -o build/lib.linux-x86_64-2.7-11g/cx_Oracle.so

Ist an diesem Setup offensichtlich etwas nicht in Ordnung?

Vielen Dank

AKTUALISIEREN

MeineLD_LIBRARY_PATH enthält das obige lib-Verzeichnis mitlibclntsh.so.11.1

$ echo $LD_LIBRARY_PATH
/apps/oracle/client/11.2.0.1/lib

Dies scheint keinen Unterschied zu machen. Ich erstelle die Datei cx_Oracle.so neu und es wird immer noch angezeigtlibclntsh.so.11.1 => not found wenn ich renne$ ldd cx_Oracle.so.

Python kann das erstellte Modul nicht laden:

Python 2.7.2 (default, Jan 19 2012, 14:38:32)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: libclntsh.so.11.1: cannot open shared object file: No such file or directory

Gelöst

Das Problem stand im Zusammenhang mit derLD_LIBRARY_PATH Umgebungsvariable. Aufgrund von Einschränkungen beim Setup, mit dem ich arbeite (corp env), musste ich cx_Oracle als anderen Benutzer (Systemkonto) erstellen. Ich habe Folgendes ausgeführt:

$ sudo -u username python27 setup.py build

ObwohlLD_LIBRARY_PATH Wurde für mich richtig eingestellt, wurde meine Version nicht verwendet, als der Befehl als anderer Benutzer ausgeführt wurde. Ich konnte erfolgreich erstellen, indem ich den Quellcode an einen Ort verschob, an dem ich über Berechtigungen verfügte, und den Build als Benutzer ausführte.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage