[PyQt] Empty bindings...what am I doing wrong?

Shaheed Haque srhaque at theiet.org
Tue Feb 21 20:25:17 GMT 2017


Following up, my problems were down to a simple issue of the directory
structure/incorrect placement of the __init__.py files.

But on the subject of Python3, I could not find anything explicit on
how to control the Python version. I see there is a "-x Py_v3" which I
get from doing a "from PyQt5.QtCore import PYQT_CONFIGURATION". So, is
the idea that I pick the right copy of PyQt5, and the correct SIP
flags will be set, or is there more to it?

Thanks, Shaheed

On 20 February 2017 at 22:42, Shaheed Haque <srhaque at theiet.org> wrote:
> LOL. No reason, but thanks for the tip(s)!
> On 20 February 2017 at 22:02, Phil Thompson <phil at riverbankcomputing.com> wrote:
>> On 20 Feb 2017, at 8:35 pm, Shaheed Haque <srhaque at theiet.org> wrote:
>>> Hi,
>>> I'm making steady progress with my SIP binding generator, and am at
>>> the point where I can actually build the generated SIP and compile the
>>> resulting code into a .so file. The problem is that the .so file
>>> appears not to contain anything in the sense that Python cannot see
>>> any useful content:
>>> ==========
>>> $ PYTHONPATH=tmp2/python python -c 'from PyKF5 import KGuiAddons;
>>> help(KGuiAddons)'
>>> Help on package PyKF5.KGuiAddons in PyKF5:
>>> NAME
>>>    PyKF5.KGuiAddons
>>> FILE
>>>    /home/srhaque/kdedev/frameworks-bindings/extra-cmake-modules/find-modules/module_generation/tmp2/python/PyKF5/KGuiAddons/__init__.py
>>>    KGuiAddons
>>> ==========
>>> I spent some time looking at the symbol table (nm -Ca
>>> .../KGuiAddons.so) and comparing it with examples from PyQt, and I see
>>> the expected _init(), initKGuiAddons() and other plausible looking
>>> stuff. I can only think that the options I am passing to SIP or
>>> possibly g++ are somehow incorrect, so here are some selected outputs
>>> to show the build procedure:
>>> === RUN SIP ===
>>> /usr/bin/sip -c tmp2/tmp/PyKF5/KGuiAddons -b
>>> tmp2/tmp/PyKF5/KGuiAddons/module.sbf -e -o -w -X
>>> includes:tmp2/tmp/PyKF5/KGuiAddons/module.includes -x
>>> KGuiAddons_KGuiAddonsmod -x VendorID -t WS_X11 -t Qt_5_6_1 -x Py_v3
>>> -I/usr/share/sip/PyQt5 -Itmp
>>> tmp2/sip/PyKF5/KGuiAddons/KGuiAddonsmod.with_features.sip
>>> ==============
>>> and then
>>> === Run g++ ===
>>> make -f module.Makefile
>>> g++ -c -g -O2 -fstack-protector-strong -Wformat
>>> -Werror=format-security  -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Wall
>>> -W -DNDEBUG -I. -I/usr/include/KF5 -I/usr/include/KF5/KCoreAddons
>>> -I/usr/include/libxml2 -I/usr/include/x86_64-linux-gnu/qt5
>>> -I/usr/include/x86_64-linux-gnu/qt5/QtCore
>>> -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64
>>> -I/usr/include/KF5/KGuiAddons
>>> -I/usr/include/x86_64-linux-gnu/qt5/QtGui
>>> -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/python2.7
>>> -o sipKGuiAddonscmodule.o sipKGuiAddonscmodule.cpp
>>> ...
>>> g++ -Wl,-Bsymbolic-functions -Wl,-z,relro -shared
>>> -Wl,--version-script=KGuiAddons.exp -o KGuiAddons.so
>>> sipKGuiAddonscmodule.o <other .o files>
>>> sipKGuiAddonsKColorCollection.o -l:libKF5IMAP.so <lots more libraries>
>>> -l:libKF5AkonadiSearchXapian.so
>>> ==========
>>> Needless to say I've tried varying the command line to SIP, to no
>>> avail. Any clues or ideas as to what I'm missing would be most
>>> welcome.
>> The error handling in Python v2 on module creation is very poor. (Why are you even bothering with Python v2?) Your best bet is to put printf() calls in the generated module init code to see how far it is getting.
>> Phil

More information about the PyQt mailing list