My favorites | Sign in
Project Home Downloads Wiki
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 201: Undefined symbols in Python3.2
2 people starred this issue and may be notified of changes. Back to list
Status:  Complete
Owner:  ----
Closed:  Nov 2011


 
Reported by nickl...@gmail.com, Aug 21, 2011
What steps will reproduce the problem?
1. Download the package or clone the git repository.
2. Build using python 2.7 (setyp.py doesn't seem to work in python 3.x, syntax error)
3. Try to "import pyodbc" using python3.2

What is the expected output? 

Nothing.

What do you see instead?

Undefined symbols. 
First it's PyExc_StandardError. I change that to PyExc_Exception, which I believe is the correct one(http://python.org/dev/peps/pep-0352). Not sure thats all that is needed though, to say the least.

Anyway, after fixing that, another pops up: _Py_ZeroStruct. 
However I cannot find that one in any part of the code.

Python 3.2 (r32:88445, Mar 25 2011, 19:56:22) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: ./pyodbc.so: undefined symbol: _Py_ZeroStruct

What version of the product are you using? On what operating system?
2.1.9 or git.
Ubuntu.

Please provide any additional information below.
I hope that someone finds this blindingly obvious.

Aug 21, 2011
Project Member #1 mkleehammer
Are you building with the "py3" branch?

That branch will become pyodbc 3.x and supports building Python 2.x and 3.x with the same codebase.

Status: Investigating
Aug 21, 2011
#2 nickl...@gmail.com
No I didn't, since I was under the impression that 2.1.9 would have Python3.x support.

Anyway, I tried using the py3 branch that an it didn't compile, I got: 
pyodbc/src/row.cpp:386:1: error: invalid conversion from ‘PyObject* (*)(PyObject*, Py_ssize_t, Py_ssize_t)’ to ‘void*’

Aug 21, 2011
#3 nickl...@gmail.com
Oh, and yes, the py3 setup.py worked in python3.2, with the exception of the gcc error of course.
Aug 22, 2011
#4 nickl...@gmail.com
I just realised my first reply could be considered somewhat snarky. 
That wasn't the intention.
Aug 31, 2011
#5 nickl...@gmail.com
Hm, I am getting the _Py_ZeroStruct error when trying to run psycopg2 v 2.4.2 as well. That one is also supposed to work on Python 3. I am running on python 3.2 right now.
Things are getting really strange around here.

Sep 1, 2011
#6 andres.o...@gmail.com
Same situation with Python 3.2 + Ubuntu 11.04 x64.
Sep 30, 2011
#7 neilbed...@gmail.com
I'm getting, 

error: invalid conversion from ‘PyObject* (*)(PyObject*, Py_ssize_t, Py_ssize_t)’ to ‘void*’

python 3.2.2 built with --enable-shared  Ubuntu 11.04 x64

Oct 29, 2011
#8 nickl...@gmail.com
Ok, so this is now  a duplicate of #132.
Oct 29, 2011
#9 nickl...@gmail.com
Hi, 
I made the attached changes, at least it gets the code built.
I have not yet throughly tested the code(almost not at all), but it should be a step in the right direction, haven't done any C in about 20 years so please be gentle.

diff
3.6 KB   View   Download
Oct 29, 2011
#10 nickl...@gmail.com
Ok, I have now tested a little and I have made creates, drops, updates, inserts and selects and is seems to work as it is supposed to. 
So, applying the GIT-diff-patch in my above commend is a way around that.

Nov 2, 2011
Project Member #11 mkleehammer
Fixed in 3.0.1

Status: Complete
Nov 3, 2011
#12 nickl...@gmail.com
Yay!

Powered by Google Project Hosting