Re: [cx-oracle-users] Building cx_Oracle 5.2: undefined symbol: PyUnicodeUCS2_AsEncodedString
Brought to you by:
atuining
From: Anthony T. <ant...@gm...> - 2015-10-24 15:51:23
|
Hi Erik, 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. Anthony On Sat, Oct 24, 2015 at 7:57 AM, Shai Berger <sh...@pl...> wrote: > Hi Erik, > > cx_Oracle 5.2 requires Python 2.7 (or 3.4, but that's obviously not an > option > for you). That is, basically, the incompatibility you're seeing. I'm > guessing > you're using Python 2.6 because you're stuck on a RH 6.X server. > > Regretfully, cx_Oracle does not provide wheels -- meaning, you can't get > official builds for Linux, you need to build them yourself. To get the > missing > Python pieces, you'd need to install the Python development files (headers > and > libraries), I think on RH that's called "python-devel"; you may be able to > convince your system adversaries to install that for you, and then you can > use > "pip install --user" or a virtualenv to build and install cx-Oracle without > system priveleges. > > If you can't do that, perhaps you may be able to find 3rd-party builds of > cx- > Oracle for your RH version -- but that will probably be extra-frowned-upon > by > System; another option I see is to get yourself the equivalent Centos > (maybe > even as a VM on your development machine), build cx-Oracle there, and move > the > binaries to your server. I believe 5.1.3 still works with Python 2.6, but > I'm > not sure. > > HTH, > Shai. > > > On Friday 23 October 2015 22:54:02 ejo...@ea... wrote: > > I am have a pretty rough time of trying to get cx_Oracle build in some > > state I can use. > > > > BACKGROUND: I am directly on the Linux server that is hosting the Oracle > > DB I want to talk to. So, I am not installing any client software, > > thinking I can link directly with the server libraries. > > > > The server has Python 2.6 installed on it, but when trying to run python > > setup.py, I see all sort of complaints about libraries such as Python.h > > and others that it can't find. > > > > I'm not a guru C developer, gcc user or Linux wizard, but I know enough > > to be dangerous. > > > > > > WHAT I HAVE DONE > > So, I don't know why those are not found .h files are not found. > > Indeed, if I dig around on the system, I can't find them. So, I > > figured screw it - I'll just go fetch Python sources myself, which I > > have done for Python 2.6. I then run configure in the python directory, > > which generates pyconfig.h, and I copy that down a level into Include/. > > > > So, then I just hacked the gcc command that was output from python > > setup.py to add this include directory (last argument before -c): > > > > gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall > > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector > > --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv > > -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions > > -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic > > -D_GNU_SOURCE -fPIC -fwrapv -fPIC > > -I/software/app/oracle/product/11.2.0Qv2/rdbms/demo > > -I/software/app/oracle/product/11.2.0Qv2/rdbms/public > > -I/usr/include/python2.6 -I/home/epjohn/src/Python-2.6.6/Include -c > > cx_Oracle.c -o build/temp.linux-x86_64-2.6-11g/cx_Oracle.o > > -DBUILD_VERSION=5.2 > > > > This silently generates cx_Oracle.o. > > > > I then run this other gcc command, also seen in setup.py output (appears > > to be to link the .o we just made with the rest of the stuff to make a > > shared object). So, indeed, this will silently generate cx_Oracle.so: > > > > gcc -pthread -shared build/temp.linux-x86_64-2.6-11g/cx_Oracle.o > > -L/software/app/oracle/product/11.2.0Qv2/lib -lclntsh -o > > build/lib.linux-x86_64-2.6-11g/cx_Oracle.so > > > > That seems to be the magic gem I am after. > > I copy that .so into a convenient place at /home/epjohn/pythonlib/ > > But when I try to use it, I get this ugly error message: > > > > epjohn$ 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: /home/epjohn/pythonlib/cx_Oracle.so: undefined symbol: > > PyUnicodeUCS2_AsEncodedString > > > > Just doing a Google search on PyUnicodeUCS2_AsEncodedString leads > > straight to a StackOverflow article that is (somewhat surprisingly), from > > someone trying to get cx_Oracle installed: > > > > > > > http://stackoverflow.com/questions/7951618/cx-oracle-so-undefined-symbolpy > > unicodeucs2-asencodedstring > > > > I'm not sure I follow every detail there, but the general gist seems to > > be to upgrade to cx_Oracle 5.1. But I'm already at 5.2. > > > > So... as best as I can figure it out, there's some sort of > > incompatibility between the way cx_Oracle module wants to handle Unicode > > strings and the way the default Python installation wants to handle them? > > > > I don't know... that's a guess, but can anybody provide a solution for > > how I can get these two to sync up? > > > > I do not have admin privileges on this machine, so modifying the > > existing Python, installing a new Python, installing cx_Oracle via pip, > > etc. are not options for me. Because of politics, I am basically on my > > own to try to get this going. > > > > (I had tried to first just build my own Python 2.7.10 from source, > > thinking I would then just use pip to install cx_Oracle, but then I ran > > into missing modules, like curses and readline because it couldn't find > > various libraries, and again, I can't seem to locate readline libs on > > this system. So, it is much preferable to just try to get a working > > cx_Oracle.so that the existing Python 2.6.6 can communicate with. That's > > my goal.) > > > > Thank you for reading my email. > > Your time and consideration on this issue is greatly appreciated. > > > > Desperately-hoping-for-some-help-ly, > > Erik Johnson > > > > > > > > > --------------------------------------------------------------------------- > > --- _______________________________________________ > > cx-oracle-users mailing list > > cx-...@li... > > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > > ------------------------------------------------------------------------------ > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > |