Why "Patching Qt5Cored.dll..." when building the project ?
-
Hello,
We worked for several years with Qt 4.7.3 for Windows Mingw. My team starts to migrate our projects to Qt 5.5.0. After a lot of changes, we succeeded. Now we would like to migrate to the long-term release 5.6, especially the last 5.6.2.
After installing the open source SDK, I opened our .pro file, clean and build it. I get this error:
Adding Qt5Svg for qsvgicond.dll Direct dependencies: Qt5Core Qt5Gui Qt5Network Qt5Widgets All dependencies : Qt5Core Qt5Gui Qt5Network Qt5Widgets To be deployed : Qt5Core Qt5Gui Qt5Network Qt5Svg Qt5Widgets Qt5Cored.dll is up to date. Qt5Guid.dll is up to date. Updating Qt5Networkd.dll. Qt5Svgd.dll is up to date. Qt5Widgetsd.dll is up to date. libGLESV2d.dll is up to date. libEGLd.dll is up to date. D3Dcompiler_42.dll is up to date. opengl32sw.dll is up to date. libgcc_s_dw2-1.dll is up to date. libstdc++-6.dll is up to date. libwinpthread-1.dll is up to date. Patching Qt5Cored.dll... Unable to patch C:\xxx\debug\Qt5Cored.dll: Could not write to file
Why does Qt try to patch Qt5Cored.dll ? We don't want to rebuild the Qt SDK, just use it as it is after a fresh SDK installation. We didn't had this problem with Qt 4 and Qt 5.5.0.
-
Hi
I have never seen that message from open a .pro file
Maybe the .pro call windeploy ?
https://github.com/eraxillan/windeployqt/blob/master/deployment.cpp
static bool patchQtCore(const QString &path, QString *errorMessage)
{
if (optVerboseLevel)
std::wcout << "Patching " << QFileInfo(path).fileName() << "...\n";
...Else I have zero ideas ?
-
Hi
I have never seen that message from open a .pro file
Maybe the .pro call windeploy ?
https://github.com/eraxillan/windeployqt/blob/master/deployment.cpp
static bool patchQtCore(const QString &path, QString *errorMessage)
{
if (optVerboseLevel)
std::wcout << "Patching " << QFileInfo(path).fileName() << "...\n";
...Else I have zero ideas ?
@mrjj Hello, you are right. We added QMAKE_POST_LINK += windeployqt $$DESTDIR/$${TARGET}.dll $$escape_expand(\n\t) in the .pro files.
Shouldn't we use it ? We are new in Qt 5. Could windeploy need to patch some Qt DLL ? If so, perhaps shouldn't we use it.
-
@mrjj Hello, you are right. We added QMAKE_POST_LINK += windeployqt $$DESTDIR/$${TARGET}.dll $$escape_expand(\n\t) in the .pro files.
Shouldn't we use it ? We are new in Qt 5. Could windeploy need to patch some Qt DLL ? If so, perhaps shouldn't we use it.
@Pamplemousse-MK-2
Well since we use and recommend the windeployqt to make the deployment folder,
and i have never seen anything mention before about it,
its safe to assume that
its ok to do
and normally just works as intended.So the actually error is "Could not write to file"
so for some reason it fails to write there.Could you maybe run tool by hand and see if it gives more info.
Maybe its just nothing - meaning sometimes the DLL is just loaded and hence locked for writing.
Does it say write error even the very first time?
-
Hi, just want to add, it's correct that windeployqt wants to patch Qt5Core.dll (and its debug cousin Qt5Cored.dll). When copying Qt's .dlls from your installation directory it wants to get rid of ("neuter") a patch made earlier to Qt5Core(d).dll when you installed Qt: the path to Qt's installation directory.
Here's an example of a windeployqt patch: from "qt_prfxpath=C:\Qt\5.7\msvc2013" to "qt_prfxpath=."
-
@Pamplemousse-MK-2
Well since we use and recommend the windeployqt to make the deployment folder,
and i have never seen anything mention before about it,
its safe to assume that
its ok to do
and normally just works as intended.So the actually error is "Could not write to file"
so for some reason it fails to write there.Could you maybe run tool by hand and see if it gives more info.
Maybe its just nothing - meaning sometimes the DLL is just loaded and hence locked for writing.
Does it say write error even the very first time?
@mrjj OK. I tried to execute windeployqt manually, and got the same problem. We face the problem on two computers: my workstation and a Windows server for our nightly builds.
-
Hi everyone,
I tried to build an example of the SDK, the Calendar widget example. I build it in debug and in release in command line. Then I run windeployqt
For the debug build, I still have the same problem.
For the release build, the deploy was successful:C:\QtSDK\Qt-5.6.2\Examples\Qt-5.6\widgets\widgets\calendarwidget>windeployqt C:\ QtSDK\Qt-5.6.2\Examples\Qt-5.6\widgets\widgets\calendarwidget\release C:\QtSDK\Qt-5.6.2\Examples\Qt-5.6\widgets\widgets\calendarwidget\release\calenda rwidget.exe 32 bit, release executable Adding Qt5Svg for qsvgicon.dll Direct dependencies: Qt5Core Qt5Gui Qt5Widgets All dependencies : Qt5Core Qt5Gui Qt5Widgets To be deployed : Qt5Core Qt5Gui Qt5Svg Qt5Widgets Qt5Core.dll is up to date. Qt5Gui.dll is up to date. Qt5Svg.dll is up to date. Qt5Widgets.dll is up to date. libGLESV2.dll is up to date. libEGL.dll is up to date. D3Dcompiler_42.dll is up to date. opengl32sw.dll is up to date. libgcc_s_dw2-1.dll is up to date. libstdc++-6.dll is up to date. libwinpthread-1.dll is up to date. Patching Qt5Core.dll... qsvgicon.dll is up to date. qdds.dll is up to date. qgif.dll is up to date. qicns.dll is up to date. qico.dll is up to date. qjpeg.dll is up to date. qsvg.dll is up to date. qtga.dll is up to date. qtiff.dll is up to date. qwbmp.dll is up to date. qwebp.dll is up to date. qwindows.dll is up to date. Creating qt_ca.qm... Creating qt_cs.qm... Creating qt_de.qm... Creating qt_en.qm... Creating qt_fi.qm... Creating qt_fr.qm... Creating qt_he.qm... Creating qt_hu.qm... Creating qt_it.qm... Creating qt_ja.qm... Creating qt_ko.qm... Creating qt_lv.qm... Creating qt_pl.qm... Creating qt_ru.qm... Creating qt_sk.qm... Creating qt_uk.qm...
Am I allowed to patch the debug DLL of Qt ?
-
We are having the exact same issue. We are running the following with Qt 5.6.2:
cmake -E env PATH=/path/to/qt/bin windeployqt.exe --debug --qmldir /path/to/qml /path/to/output/exec
And get the same error:
Patching Qt5Cored.dll... Unable to patch /path/to/output/Qt5Cored.dll: Could not write to file
This does not happen on Qt 5.6.0, or when we use --release instead of --debug.
-
Hi, I also use windeployqt to distribute my app to other computers, and because Microsoftdoes not like that you distribute the debug flavored dlls to other computers, I always switch to Release mode before windeployqt. Perhaps 5.6.2 was not tested properly for debug distributions...
-
Hello,
We decide to not use Qt 5.6.2, because we would like to use QChart, which is available in 5.7. We don't seem to have the same problem with 5.7.
-
Just a small follow-up (hope that's okay, given that this is an older thread now...)
AppVeyor (which I use for CI/CD on a number of open source projects) recently updated their Qt 5.6 installation from Qt 5.6.1 to Qt 5.6.2, so I'm now seeing this issue too. The interesting thing is that while AppVeyor builds my Bipolar project against 38 different configurations (example buildset), there's only one that's failing: "QTDIR=C:\Qt\5.6\mingw49_32; Configuration: debug"
So it seems this issue is specific to Qt 5.6.2 + MinGW + Debug (no issues with 5.6.1, 5.7.x, 5.6.2 with MSVC, release, etc).
Since Qt 5.6 is a "long-term support" release, I'll see if there's an existing bug report for it, and add one if not.
Cheers.
-
Ah, so it looks like it's a result of QTBUG-56616.
Cheers.