32

Recently we have been migrating our QT based application on Windows from QT 4.8 to QT 5, and we have run into a issue with deployment. Note that our app has not changed, we have only built it with new QT5 framework. With some effort we got it to build with VS2010 based QT5 library; and I successfully ran the app from Qt Creator.

As we did with QT4, we have included a required set of QT libraries with the installer.

In our testing phase, when we installed our QT5 app on a clean machine; it would not start. Not only the application did not start, but it did not output any errors.

We ran the app through the dependency checker; and there were no missing library dependencies at all.

1
  • I have the same problem on Windows XP as well, where dependency walker reports 3 irrilevant missing libraries. I'm deploying MinGW based application.
    – CapelliC
    Jun 18, 2013 at 7:58

8 Answers 8

37

After several days of search with no progress, we stumbled upon a QT bug:

https://bugreports.qt.io/browse/QTBUG-28766

With QT5, in addition to expected QT libraries, msvcr100.dll, and msvcp100.dll; it turns out that you have to ship your application with:

platforms/qminimal.dll
platforms/qwindows.dll

as well. Which is found in your local QT5 library install @: \Qt5.0.0\5.0.0\msvc2010\plugins\platforms I searched everywhere, and I was unable to find this info in their documentation.

5
  • 2
    depends.exe would have helped you greatly, also the msvc*.dll is not required if you statically link the runtime - noticed you said depends didn't help, in that case procmon.exe would have
    – paulm
    Jan 4, 2013 at 13:28
  • 1
    @Aki, do you know how it finds qwindows.dll on the development machine? It seems to require QtCore.dll (and others) to be in the same dir as the .exe file. But somehow it doesn't require qwindows.dll to be in the platforms subfolder. I haven't found anything pointing to C:/Qt5.0.0/... in the system variables or in the registry. Jan 7, 2013 at 8:17
  • Not sure how it find the dll. FWIW: On my dev box, I run my program out of QtCreator with no issues. When QTCreator executes my applications it sets the correct environment for it to find the necessary dlls(both QT libs and qminimal.dll...). Btw, this is all done automatically, I never had to set anything. Hopefully that helps...
    – Aki
    Jan 7, 2013 at 15:19
  • That is exactly how we deploy our Windows applications. The platform subdirectory must be there. Aug 24, 2013 at 11:33
  • 2
    platforms/qminimal.dll is not always required. qwindows.dll is. Sep 12, 2013 at 23:48
15

For me to run standalone "Hello World" gui application ( Qt sdk 5.0.1 mingw, Win7 x64 ). I need to add next files to program dir:

  1. platforms/qwindows.dll
  2. D3DCompiler_43.dll
  3. icudt49.dll
  4. icuin49.dll
  5. icuuc49.dll
  6. libEGL.dll
  7. libgcc_s_sjlj-1.dll
  8. libGLESv2.dll
  9. libstdc++-6.dll
  10. libwinpthread-1.dll
  11. Qt5Core.dll
  12. Qt5Gui.dll
  13. Qt5Widgets.dll

The full deployment information for windows available at qt 5.5 doc

1
  • Many thanks for this list, unfortunately Qt5 application doesn't tell me which exactly lib is missing, just unintelligible error is reported. May 17, 2013 at 12:37
7

The better choice is use: windeployqt.exe. This tool resolves the all dependencies of your application.exe.

3
  • Yes I don't know why this is not mentionned in BIG FONT RED on the deployement page of QT wiki !
    – Yves Lange
    Dec 1, 2015 at 15:29
  • Sorry to say, but it doesn't. If you developing a qml app, it misses all the qml needed files (QtQml, QtQuick, QtQuick.2)
    – RvdK
    May 23, 2016 at 15:02
  • 1
    @RvdK windeployqt accepts --qmldir <directory> command line argument to resolve QML dependencies. (see windeployqt -help or doc.qt.io/qt-5/windows-deployment.html)
    – Benjamin T
    Jul 27, 2016 at 15:30
3

Yes, well spotted. I was having the same deployment problems using qt 5.0.2.

Likewise installed platforms folder with these two dlls in the apps folder, and the deployments on vista and win7 now work.

Dependency walker does not help here as it does not notify qwindows.dll or qminimal.dll as required dlls.

The platforms dlls in my Qt installation are at \Qt\5.0.2\mingw47_32\plugins\platforms.

2

Qt platform dlls are located in the "plugins" folder in "qtbase": C:\Qt\5.0.0\qtbase\plugins\platforms

2

for notepad tutorial, on win7 & qt5.1.1

the deploy steps is:

* change build mode to release, not debug,
* build,
* create a output folder somewhere
    e.g. desktop/notepad/
* 
* copy file to output folder
    file list:
    * from "workspace_home/build-notepad-xxx-Release/release"
        * notepad.exe
    * from "qt_home/5.1.1/msvc2010/bin"
        * icudt51.dll
        * icuin51.dll
        * icuuc51.dll
        * libEGL.dll
        * libGLESv2.dll
        * Qt5Core.dll
        * Qt5Gui.dll
        * Qt5Widgets.dll
        * 
    * from "qt_home/5.1.1/msvc2010/plugins/platforms"
        * platforms/ (need to create this sub folder in the output folder)
            * qwindows.dll
        * 
    * 
* 
* run the .exe file, make sure it works,
* 
* ok
* 
1

It seems that an empty qt.conf located in the same directory as the application is causing trouble starting a Qt5 app on Windows 7. Try to delete it.

1

I used an instance of QMediaPlayer and QMediaPlaylist and my application would no longer start, giving the following error: This application failed to start because it could not find or load the Qt platform plugin "windows". Reinstalling the application may fix this problem.

After spending 4 days trying to figure out what was going on, we found out there is a hardcoded path in Qt5Core.dll to load the plugins, particularly the file wmfengine.dll. Make sure you compile Qt5Core to not have this hardcoded path (:\Qt\5.5\msvc2010).

screenshot of WinDiff

Hardcoded path in Qt5Core.dll failing the plugin wmfengine.dll to load

1
  • Using the The Windows Deployment Tool (windeployqt) can also generate a new QT5Core.dll that will remove the hardcoded path. It will be in your app directory. Aug 4, 2016 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.