ChatCrawlersearch across public Telegram Open the app
Q

Qt for Python (PySide/Shiboken)

20 July 2025
2025-07-20×
20 July 2025
A
Ссылка
click to show
@skinkie I did it using Meson (https://github.com/SciQLop/SciQLopPlots), the best way I found was to use advanced search on GitHub to find as much projects building PySide6 bindings. The funny part was that even with no support in Meson it didn't look much scarier than with CMake. The really painful part for me is the XML. IIRC I took inspiration mainly from Cutter2 and PySide6-QtADS.
S
alexis jeandet@skinkie I did it using Meson (https://github.com/SciQLop/SciQLopPlots), the best way I found was to use advanced search on GitHub to find as much projects building PySide6 bindings. The funny part was that even with no support in Meson it didn't look much scarier than with CMake. The really painful
I have multiple issues: - QOpenGLWidget (Shibokenpart) imports something that is not defined, using extern I am able to make that part compile - The final linked library has missing symbols when trying to import it in Python. Also related to QOpenGLWidgit. My goal for today is to make a repo so my issues is 'easily' reproduced. If someone could take a peak, what might be wrong either in my part or in Shiboken that would be very helpful.
S
>>> from PySide6.QtOpenGLWidgets import QOpenGLWidget >>> import pyqmaplibre Traceback (most recent call last): File "<python-input-5>", line 1, in <module> import pyqmaplibre ImportError: /home/skinkie/Sources/pyside-maplibre-native-qt2/build/pyqmaplibre.so: undefined symbol: _Z18init_QOpenGLWidgetP7_object
A
weird I can't find this symbol anywhere in libQt6OpenGLWidgets.so.6.9.1, QtOpenGLWidgets.abi3.so
You get one fore each wrapped class init_Class, do you have <load-typesystem name="typesystem_openglwidgets.xml" generate="no" /> in your xml binding defs?
A
In fact the error you get is "normal", _Z18init_QOpenGLWidgetP7_object is generated by shiboken inside PySide6.QtOpenGLWidgets module and it is not as most symbols in a Python extension module. The question is why your module needs this symbol.
<typesystem package="pyqmaplibre"> <load-typesystem name="typesystem_openglwidgets.xml" /> <namespace-type name="QMapLibre" visible="false"> <object-type name="GLWidget"> <include file-name="pyqmaplibre_global.h" location="global"/> </object-type> </namespace-type> </typesystem>
So now you would probably reply that I would need to add "no"
S
Then this would happen: In file included from /home/skinkie/Sources/pyside-maplibre-native-qt2/build/bindings/generated/pyqmaplibre/pyqmaplibre_module_wrapper.cpp:21: /home/skinkie/Sources/pyside-maplibre-native-qt2/build/bindings/generated/pyqmaplibre/pyqmaplibre_python.h:10:10: fatal error: pyside6_qtopenglwidgets_python.h: No such file or directory 10 | #include <pyside6_qtopenglwidgets_python.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
/home/skinkie/Sources/pyside-maplibre-native-qt2/build/bindings/generated/pyqmaplibre/pyqmaplibre_module_wrapper.cpp: In function ‘void initInheritance()’: /home/skinkie/Sources/pyside-maplibre-native-qt2/build/bindings/generated/pyqmaplibre/pyqmaplibre_module_wrapper.cpp:449:67: error: ‘SBK_QOpenGLWidget_IDX’ was not declared in this scope; did you mean ‘SBK_QTreeWidget_IDX’? 449 | .addClassInheritance(&SbkPySide6_QtOpenGLWidgetsTypeStructs[SBK_QOpenGLWidget_IDX], | ^~~~~~~~~~~~~~~~~~~~~ | SBK_QTreeWidget_IDX
It takes more than 10 minutes to compile maplibre, and it cannot be multithreaded, so I am not removing the build folder.
S
I can obviously remove the bindings.
Without generate = yes on the opengl part the error above (and manual removing of the header) remains at play.
It is not yet at the level I had before, because now it complains about Shiboken missing, or the other OpenGL error.
But at least you can see where I am at.
S
If I do generate="no" remove the header manually, and remove the single line the compilation fails on again. Then it builds the library. But the linking still seems to fail ImportError: /home/skinkie/Sources/reproduced/build/pyqmaplibre.so: undefined symbol: _Z23init_QMapLibre_GLWidgetP7_object ldd shows it should be included: libQMapLibreWidgets.so.3 => /home/skinkie/Sources/reproduced/build/maplibre-native-qt/src/widgets/libQMapLibreWidgets.so.3
S
I have also tried the wiggly example ImportError: /home/skinkie/Sources/widgetbinding/wiggly.so: undefined symbol: _ZN6PySide18initQObjectSubTypeEP11_typeobjectP7_objectS3_
A
I had to do something similar with Meson build, that's not fun and there are no way around as far as I know.
A
Did you run the main.py or tried to manually import the module from Python?
S
[skinkie@archlinux widgetbinding]$ python main.py Traceback (most recent call last): File "/home/skinkie/Sources/widgetbinding/main.py", line 9, in <module> from dialog import Dialog File "/home/skinkie/Sources/widgetbinding/dialog.py", line 8, in <module> from wiggly import WigglyWidget as WigglyWidgetCPP ImportError: /home/skinkie/Sources/widgetbinding/wiggly.so: undefined symbol: _ZN6PySide18initQObjectSubTypeEP11_typeobjectP7_objectS3_
A
Weird, you did install PySide6 wheels and build your example against the same Qt and PySide versions?
On ArchLinux pyside6.9.1 is installed, the 'venv' variant has an issue with libxml2.
S
But yesterday I started from the original Wiggy example, and that also failed. So at this point my guess is that there is something wrong on both Gentoo (which requires a venv) and natively on ArchLinux. Given that the basic example does not even work, I wonder what to do next. My guess was, if wiggy works, then introduce a namespace and see if that still works.
S
The effect on gentoo is worse. This seems basically the interaction between clang and gcc. [ 46%] Running generator for /home/skinkie/Sources/widgetbinding/bindings.xml. qt.shiboken: (bindings) findClangBuiltInIncludesDir: Falling back from /usr/lib/llvm/20/lib64 to /usr/lib/llvm/20/lib. qt.shiboken: (bindings) findClangBuiltInIncludesDir: No subdirectories found in /usr/lib/llvm/20/lib/clang. qt.shiboken: (bindings) CLANG v0.64, builtins includes directory: /usr/lib/llvm/20/include /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/cstddef:52:10: fatal error: 'stddef.h' file not found (bindings) Errors in /tmp/bindings_ZKXgsq.hpp: /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/cstddef:52:10: fatal: 'stddef.h' file not found /tmp/bindings_ZKXgsq.hpp:1:10: note: in file included from /tmp/bindings_ZKXgsq.hpp:1: /home/skinkie/Sources/widgetbinding/bindings.h:6:10: note: in file included from /home/skinkie/Sources/widgetbinding/bindings.h:6: /home/skinkie/Sources/widgetbinding/wigglywidget.h:7:10: note: in file included from /home/skinkie/Sources/widgetbinding/wigglywidget.h:7: /home/skinkie/Sources/widgetbinding/macros.h:7:10: note: in file included from /home/skinkie/Sources/widgetbinding/macros.h:7: /usr/include/qt6/QtCore/qglobal.h:14:12: note: in file included from /usr/include/qt6/QtCore/qglobal.h:14: (bindings) Clang: 1 diagnostic messages: /usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/cstddef:52:10: fatal: 'stddef.h' file not found /tmp/bindings_ZKXgsq.hpp:1:10: note: in file included from /tmp/bindings_ZKXgsq.hpp:1: /home/skinkie/Sources/widgetbinding/bindings.h:6:10: note: in file included from /home/skinkie/Sources/widgetbinding/bindings.h:6: /home/skinkie/Sources/widgetbinding/wigglywidget.h:7:10: note: in file included from /home/skinkie/Sources/widgetbinding/wigglywidget.h:7: /home/skinkie/Sources/widgetbinding/macros.h:7:10: note: in file included from /home/skinkie/Sources/widgetbinding/macros.h:7: /usr/inc
A
I had a lot of issues like this in the past, usually (IIRC) it comes from the arguments passed to shiboken. If you use containers, you might have more luck using a manylinux one where most pyside projects build successfully
those are specific containers maintained by PyPI guys to build Python wheels
A
I also have no issues building my projects on a Fedora 41 too, using a dedicated virtualenv and installing Qt using either the official installer or aqtinstall
If I change to clang explicitly I get: In file included from /mnt/storage/home/skinkie/Sources/widgetbinding/build/venv/lib/python3.12/site-packages/PySide6/include/QtGui/pyside6_qtgui_python.h:15, from /mnt/storage/home/skinkie/Sources/widgetbinding/build/venv/lib/python3.12/site-packages/PySide6/include/QtWidgets/pyside6_qtwidgets_python.h:15, from /home/skinkie/Sources/widgetbinding/build/wiggly/wiggly_python.h:10, from /home/skinkie/Sources/widgetbinding/build/wiggly/wiggly_module_wrapper.cpp:21: /mnt/storage/home/skinkie/Sources/widgetbinding/build/venv/lib/python3.12/site-packages/PySide6/include/QtCore/pyside6_qtcore_python.h:43:10: fatal error: qjsonparseerror.h: No such file or directory 43 | #include <qjsonparseerror.h> | ^~~~~~~~~~~~~~~~~~~ compilation terminated. make[2]: *** [CMakeFiles/wiggly.dir/build.make:107: CMakeFiles/wiggly.dir/wiggly/wiggly_module_wrapper.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:129: CMakeFiles/wiggly.dir/all] Error 2 make: *** [Makefile:136: all] Error 2
So to me this entire ecosystem feels extremely fragile.
these are the headers (not) provided by the virtual env
A
git clone https://github.com/skinkie/wigglywidget cd wigglywidget source ~/PySide6.9.0Venv3.13/bin/activate mkdir build cd build PATH=$PATH:/home/jeandet/Qt/6.9.0/gcc_64/bin cmake .. make LD_LIBRARY_PATH=. PYTHONPATH=. python ../main.py
Calendar: July 2025
MoTuWeThFrSaSu112337415167891011121314151161718119120522129223232425262728292301311
Archive by month
Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog