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

Shaheed Haque srhaque at theiet.org
Mon Feb 20 20:35:51 GMT 2017


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 on package PyKF5.KGuiAddons in PyKF5:




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

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/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>

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

Thanks, Shaheed

P.S. Some selected extracts from the resulting .so file:

$ ls -l tmp2/python/PyKF5/KGuiAddons/
total 2720
-rw-rw-r-- 1 srhaque srhaque       0 Feb 20 20:19 __init__.py
-rw-rw-r-- 1 srhaque srhaque     219 Feb 19 11:26 __init__.pyc
-rwxrwxr-x 1 srhaque srhaque 2778560 Feb 20 20:19 KGuiAddons.so
$ nm -Ca tmp2/python/PyKF5/KGuiAddons/KGuiAddons.so
00000000000054a0 t _init
00000000000054a0 t .init
0000000000215b88 t .init_array
0000000000005f90 T initKGuiAddons
000000000000fb00 t init_type_KColorCollection
000000000000c8d0 t init_type_KDateValidator
0000000000008040 t meth_KModifierKeyInfo_setKeyLatched
0000000000007f20 t meth_KModifierKeyInfo_setKeyLocked
0000000000009a80 t meth_KModifierKeyInfo_timerEvent
0000000000007d40 t meth_KWordWrap_boundingRect
0000000000007bc0 t meth_KWordWrap_drawFadeoutText
0000000000000000 a sipKGuiAddonsKModifierKeyInfo.cpp
0000000000000000 a sipKGuiAddonsKWordWrap.cpp
0000000000000000 a sipKGuiAddonsQHash0100QtCorner0100QIcon.cpp
0000000000000000 a sipKGuiAddonsQList0100QtKey.cpp
0000000000219668 b sip_KGuiAddons_qt_metacall
0000000000219660 b sip_KGuiAddons_qt_metacast
0000000000219670 b sip_KGuiAddons_qt_metaobject

More information about the PyQt mailing list