Re: Building cx_Oracle 5.2: undefined symbol: now PyCapsule_Import

Anthony Tuininga <[email protected]> Mon, 26 Oct 2015 13:33:03 -0600
Newsgroups gmane.comp.python.db.cx-oracle
Message-ID <CAE1XR-64P=ghbYXKbj4-ofATKUS-tQ7o3G2u_3DFbOZpaq0+fg@mail.gmail.com>
Hi Erik,

Not quite. :-) You *NEED* to build with Python 2.6. So make sure you
download and build Python 2.6 using the option I indicated. Then things
should work well -- barring any other discrepancies in how the system
Python and the Python you build are actually built. The easiest method is
to have the Python-devel package installed as it will have the options
defined there for you -- but if you don't have that option available to
you, the next best is to build your own Python 2.6.

Good luck!

Anthony

On Mon, Oct 26, 2015 at 12:15 PM, <[email protected]> wrote:

>
> Thank you, Shai and Anthony for your responses.
>
> So, Anthony said this:
>
> > One other issue that should be considered: if you are trying to use a
> > cx_Oracle built with the Python 2.6 you downloaded and built, but using
> the
> > system wide Python you may run into the difficulty you experienced. If,
> > however, you make sure that you build Python with the same configuration
> as
> > the system wide Python you should be good.
> >
> > If you run the system wide Python and print the value of sys.maxunicode
> you
> > should get 1114111 and if you run the one you built then you should get
> > 65535 (a different value).
> >
> > The option you want to the configure command when building Python is
> > --enable-unicode=ucs4.
> > Once you have enabled that on your personally built Python and confirmed
> > that running both gives the same value for sys.maxunicode you should be
> > good to go. :-)
> >
> > And even though I don't personally use Python 2.6 or test with it, there
> > shouldn't be any difficulties with using it yet; if there are, let me
> know.
>
>
>
>
> Let's check my understanding...
> I think Anthony is saying here that I should be able to get cx_Oracle
> built with my own Python 2.7.10, but run that .so with 2.6?
>
> I'm hoping that's what's implied because it is what I am trying to do...
>
> WHAT I DID NOW
> ---------------
> * Rebuilt my own Python 2.7.10 (w/ no args to configure)
> * Verified indeed system 2.6.6 has sys.maxunicode of 1114111
> * Verified my python 2.7.10 has sys.maxunicode of 65535
> * re-ran configure w/ --enable-unicode=ucs4
> * My python 2.7.10 now has sys.maxunicode of 1114111
> * ran cx_Oracle 5.2's setup.py with my python 2.7.10
> GOOD => cx_Oracle.so generated cleanly directly without me having to
>     muck with gcc commands. It does generate a couple of warnings, which
>     I'm including here in case you want to change anything. (Always nicer
>     from user's end to receive "warm fuzzies" instead of "cold
>     pricklies"):
>
>
> epjohn_gpqa1$ /home/epjohn/src/Python-2.7.10/python setup.py build
> running build
> running build_ext
> building 'cx_Oracle' extension
> creating build/temp.linux-x86_64-2.7-11g
> gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall
> -Wstrict-prototypes -fPIC
> -I/software/app/oracle/product/11.2.0Qv2/rdbms/demo
> -I/software/app/oracle/product/11.2.0Qv2/rdbms/public
> -I/home/epjohn/src/Python-2.7.10/Include -I/home/epjohn/src/Python-2.7.10
> -c cx_Oracle.c -o build/temp.linux-x86_64-2.7-11g/cx_Oracle.o
> -DBUILD_VERSION=5.2
> In file included from
> /software/app/oracle/product/11.2.0Qv2/rdbms/public/oci.h:3045,
>                  from cx_Oracle.c:10:
> /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10795:
> warning: function declaration isn't a prototype
> /software/app/oracle/product/11.2.0Qv2/rdbms/public/ociap.h:10801:
> warning: function declaration isn't a prototype
> creating build/lib.linux-x86_64-2.7-11g
> gcc -pthread -shared build/temp.linux-x86_64-2.7-11g/cx_Oracle.o
> -L/software/app/oracle/product/11.2.0Qv2/lib -lclntsh -o
> build/lib.linux-x86_64-2.7-11g/cx_Oracle.so
>
>
> * re-copied the built .so into /home/epjohn/pythonlib
>
> Now, the issue about Unicode encoding seems to be gone, but I am hitting
> the next thing in the chain:
>
> epjohn_gpqa1$ python
> Python 2.6.6 (r266:84292, Jul 23 2015, 05:13:40)
> [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>>
> >>> import sys
> >>> sys.path.append('/home/epjohn/pythonlib')
> >>> import cx_Oracle
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: ./cx_Oracle.so: undefined symbol: PyCapsule_Import
>
>
> Ummm... I am getting out towards the limit of my expertise here...
> This might be helpful:
>
> epjohn_gpqa1$ ldd cx_Oracle.so
>         linux-vdso.so.1 =>  (0x00007ffed0559000)
>         libclntsh.so.11.1 =>
> /software/app/oracle/product/11.2.0Qv2/lib/libclntsh.so.11.1
> (0x00007f9e9753f000)
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f9e9730e000)
>         libc.so.6 => /lib64/libc.so.6 (0x00007f9e96f7a000)
>         libnnz11.so =>
> /software/app/oracle/product/11.2.0Qv2/lib/libnnz11.so (0x00007f9e96bad000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x00007f9e969a8000)
>         libm.so.6 => /lib64/libm.so.6 (0x00007f9e96724000)
>         libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f9e9650b000)
>         libaio.so.1 => /lib64/libaio.so.1 (0x00007f9e96309000)
>         /lib64/ld-linux-x86-64.so.2 (0x0000003f11200000)
>
> Indeed, we have an undefined symbol in cx_Oracle.so:
>
> epjohn_gpqa1$ nm cx_Oracle.so | grep Capsule
>                  U PyCapsule_Import
>
> I'm not sure where that should be coming from?
> I'll see if I can just back up to cx_Oracle 5.1.3
> In the meantime, any other advice?
>
> Thanks!
>
> -Erik Johnson
>
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> cx-oracle-users mailing list
> cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>

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

_______________________________________________
cx-oracle-users mailing list
cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/cx-oracle-users