Side-loading my own Qt.dll on default PiSide2 installed with pip
-
Hi all.
I'm working on a Python + Qt (PySide2) project.
Since I want to fix a bug in Qt (that I've already submitted), I want to build my own version of the Qt libraries (Core, GUI and Widgets) and give a try at bug fixing.
Also having access to the Qt source code means that, if needed, I can tackle performance issues and bugs C++ side.
Here is my workflow:
- I've installed Python 3.10.6 on my Windows machine;
- I've created a virtual env and "pip installed" PySide2 version 5.15.2.1;
- I've used git to download Qt 5-5.15.2 and I've built my own version of Qt (the idea is to manipulate Qt source code later on);
- I've copied my Qt5Core.dll, Qt5Gui.dll and Qt5Widgets.dll inside <venv folder>\Lib\site-packages\PySide2 overwriting the *.dlls already there;
At this point I can run my PySide2 app, but it crashes randomly after 10 minutes or so, segfaulting.
Before going deeper into the issue, my question is: is my workflow ok? Is overwriting the *.dlls sufficient? Do I need to build Shiboken too? Do I need to build PySide2 too?
If I run "dumpbin /headers Qt5Core.dll" for my version of the library, I get:
Microsoft (R) COFF/PE Dumper Version 14.29.30146.0 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file Qt5Core.dll PE signature found File Type: DLL FILE HEADER VALUES 14C machine (x86) 6 number of sections 630B79FC time date stamp Sun Aug 28 16:21:48 2022 0 file pointer to symbol table 0 number of symbols E0 size of optional header 2102 characteristics Executable 32 bit word machine DLL OPTIONAL HEADER VALUES 10B magic # (PE32) 14.29 linker version <many other (probably useless) rows>If I run "dumpbin /headers Qt5Core.dll" for the official "pip install" library, I get:
Microsoft (R) COFF/PE Dumper Version 14.29.30146.0 Copyright (C) Microsoft Corporation. All rights reserved. Dump of file Qt5Core.dll PE signature found File Type: DLL FILE HEADER VALUES 14C machine (x86) 6 number of sections 61D69156 time date stamp Thu Jan 6 07:51:02 2022 0 file pointer to symbol table 0 number of symbols E0 size of optional header 2102 characteristics Executable 32 bit word machine DLL OPTIONAL HEADER VALUES 10B magic # (PE32) 14.26 linker version <many other (probably useless) rows>I have the feeling that the different "linker version" (different compiler minor version) is causing a binary incompatibility.
-
Hi and welcome to devnet,
I would go with building PySide2 as well with your version of Qt. That way you ensure that you have everything using the same toolchain.