Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 support #5

Open
derpston opened this issue Apr 19, 2014 · 2 comments
Open

Python 3 support #5

derpston opened this issue Apr 19, 2014 · 2 comments

Comments

@derpston
Copy link

This module won't build under python 3:

v4l2capture.c: In function ‘Video_device_dealloc’:
v4l2capture.c:116:7: error: ‘Video_device’ has no member named ‘ob_type’

If I attempt to work around that my hackily commenting it out, the module builds but can't be imported:

ImportError: ./v4l2capture.so: undefined symbol: PyString_FromStringAndSize

That can be fixed by using PyBytes_* instead of PyString_*, but then:

ImportError: ./v4l2capture.so: undefined symbol: PyInt_FromLong

So I try to change that to PyLong_FromLong as suggested here and here

After fixing that, the next problem is:

ImportError: ./v4l2capture.so: undefined symbol: Py_InitModule3

According to here I should change that to InitModule, not InitModule3 or 4. But:

ImportError: ./v4l2capture.so: undefined symbol: Py_InitModule

So, following a suggestion here to link with --export-dynamic, I tried modifying:

gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-armv6l-3.2/v4l2capture.o -lv4l2 -o build/lib.linux-armv6l-3.2/v4l2capture.cpython-32mu.so

to

gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,--export-dynamic -Wl,-z,relro build/temp.linux-armv6l-3.2/v4l2capture.o -lv4l2 -o build/lib.linux-armv6l-3.2/v4l2capture.cpython-32mu.so

but the error remains the same:

ImportError: ./v4l2capture.so: undefined symbol: Py_InitModule

At this point, I reached the limit of my ability to hack around with this, and I need an adult. Any ideas for what might be needed to make this module compatible with python 3?

@jnohlgard
Copy link
Owner

I don't really have any time to spend on this project for the foreseeable future, so I will not be able to assist with this problem. If you solve the problems however, I would be happy to accept pull requests for it.

@derpston
Copy link
Author

py3k support is on the way thanks to @rmca: https://github.com/rmca/python-v4l2capture/tree/py3k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants