7 Replies Latest reply: Apr 27, 2010 10:14 AM by 769132 RSS

    oracle 11.2 and cx_Oracle

    769132
      Hello,
      has anyone tried to build cx_Oracle against the new Oracle 11.2 ?
      (i use python 2.4)

      for the moment rpm and build is failed.

      thank you
        • 1. Re: oracle 11.2 and cx_Oracle
          390020
          I have it working, downloaded and installed from the cheeseshop. What error do you get while compiling from sources? (I cannot really help you with the rpm).

          Mariano
          • 2. Re: oracle 11.2 and cx_Oracle
            769132
            hi,
            thanks a lot for the prompt answer,

            I followed what is written in the BUILD.txt
            But as you can see in the step 3) of build i face an error.
            Do you have to give me any hint for that?

            thanks alot!


            1) check that the link is there...

            %S[%m]%s %~ %# ll /usr/lib/oracle/11.2/client/lib/
            total 142492
            -rw-r--r-- 1 root root 342 Aug 14 2009 glogin.sql
            lrwxrwxrwx 1 root root 17 Apr 22 17:33 libclntsh.so -> libclntsh.so.11.1
            -rw-r--r-- 1 root root 40088477 Aug 14 2009 libclntsh.so.11.1
            -rw-r--r-- 1 root root 6986848 Aug 14 2009 libnnz11.so
            lrwxrwxrwx 1 root root 15 Apr 22 17:33 libocci.so -> libocci.so.11.1
            -rw-r--r-- 1 root root 1879549 Aug 14 2009 libocci.so.11.1
            -rw-r--r-- 1 root root 89377610 Aug 14 2009 libociei.so
            -rw-r--r-- 1 root root 152304 Aug 14 2009 libocijdbc11.so
            -rw-r--r-- 1 root root 1501651 Aug 14 2009 libsqlplusic.so
            -rw-r--r-- 1 root root 1218075 Aug 14 2009 libsqlplus.so
            -rw-r--r-- 1 root root 1996228 Aug 14 2009 ojdbc5.jar
            -rw-r--r-- 1 root root 2111220 Aug 14 2009 ojdbc6.jar
            -rw-r--r-- 1 root root 298388 Aug 14 2009 ottclasses.zip
            -rw-r--r-- 1 root root 37807 Aug 14 2009 xstreams.jar


            2) check the env variables
            %S[%m]%s %~ %# echo $ORACLE_HOME
            /usr/lib/oracle/11.2/client
            %S[%m]%s %~ %# echo $LD_LIBRARY_PATH
            /usr/lib/oracle/11.2/client/lib::/usr/lib/oracle/11.2/client


            3) > build

            %S[%m]%s %~ %# python setup.py build
            running build
            running build_ext
            building 'cx_Oracle' extension
            gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fPIC -I/usr/include/oracle/11.2/client -I/usr/include/python2.4 -c cx_Oracle.c -o build/temp.linux-x86_64-2.4-11g/cx_Oracle.o -DBUILD_VERSION=5.0.3
            cx_Oracle.c:6:20: error: Python.h: No such file or directory
            cx_Oracle.c:7:22: error: datetime.h: No such file or directory
            cx_Oracle.c:8:26: error: structmember.h: No such file or directory
            In file included from cx_Oracle.c:97:
            StringUtils.c:62: error: expected declaration specifiers or ‘...’ before ‘PyObject’
            StringUtils.c: In function ‘StringBuffer_FromUnicode’:
            StringUtils.c:64: error: ‘obj’ undeclared (first use in this function)
            StringUtils.c:64: error: (Each undeclared identifier is reported only once
            StringUtils.c:64: error: for each function it appears in.)
            StringUtils.c:76: warning: cast to pointer from integer of different size
            StringUtils.c: At top level:
            • 3. Re: oracle 11.2 and cx_Oracle
              390020
              Yes, that's easy. You need the Python development files to successfully compile cx_Oracle (it's asking for Python.h). In Ubuntu its name is python-dev but I don't really know the name for that same package in your distro of choice.

              Hope it helps.
              • 4. Re: oracle 11.2 and cx_Oracle
                769132
                thanks alot Mariano,

                it is much better now
                (but still not there)

                have you faced the error that i see: ?
                i checked that the soft link is there and the env vars are
                echo $LD_LIBRARY_PATH
                /usr/lib/oracle/11.2/client
                echo $ORACLE_HOME
                /usr/lib/oracle/11.2/client



                python setup.py build
                running build
                running build_ext
                building 'cx_Oracle' extension
                gcc -pthread -shared build/temp.linux-x86_64-2.4-11g/cx_Oracle.o -L/usr/lib/oracle/11.2/client/lib -L/usr/lib/oracle/11.2/client -lclntsh -o build/lib.linux-x86_64-2.4-11g/cx_Oracle.so
                /usr/bin/ld: skipping incompatible /usr/lib/oracle/11.2/client/lib/libclntsh.so when searching for -lclntsh
                /usr/bin/ld: cannot find -lclntsh
                collect2: ld returned 1 exit status
                error: command 'gcc' failed with exit status 1
                • 5. Re: oracle 11.2 and cx_Oracle
                  cj
                  Did you install the right version of Instant Client? Is there a 32/64 bit mix up somewhere?
                  • 6. Re: oracle 11.2 and cx_Oracle
                    390020
                    I have to agree with cj to start looking on that side first (23 vs 64 bits). I have that kind of problems (missing ld libraries, nothing that a few symlinks couldn't solve) with instant client but with an standard client it has always been straightforward.
                    As an additional help check out the setup.py file from cx_Oracle. It tells you exactly where it is looking for the oracle home or ld library path (it uses the os.environ but sometimes it appens an extra path).
                    • 7. Re: oracle 11.2 and cx_Oracle
                      769132
                      thanks alot Mariano,

                      i installed oracle 64 and not works :-)

                      best wishes!