Skip to content

Python 3 support #5

@derpston

Description

@derpston

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions