Usually to deploy a Qt project I either:
So I now wanted to try windeployqt which for me exists in D:\install\Qt\5.5\mingw492_32\bin\
Then I ran it using:
D:\>D:\install\Qt\5.5\mingw492_32\bin\windeployqt.exe d:\software\build-qtGuiTestApp-Desktop_Qt_5_5_0_MinGW_32bit-Debug\debug
Here is the result output:
D:\software\build-qtGuiTestApp-Desktop_Qt_5_5_0_MinGW_32bit-Debug\debug\qtGuiTes
tApp.exe 32 bit, debug executable
Adding Qt5Svg for qsvgicond.dll
Skipping plugin qmldbg_qtquick2d.dll due to disabled dependencies.
Skipping plugin qmldbg_tcpd.dll due to disabled dependencies.
Direct dependencies: Qt5Core Qt5Network Qt5WebKitWidgets Qt5Widgets
All dependencies : Qt5Core Qt5Gui Qt5Multimedia Qt5MultimediaWidgets Qt5Networ
k Qt5OpenGL Qt5Positioning Qt5PrintSupport Qt5Qml Qt5Quick Qt5Sensors Qt5Sql Qt5
WebKit Qt5WebKitWidgets Qt5Widgets
To be deployed : Qt5Core Qt5Gui Qt5Multimedia Qt5MultimediaWidgets Qt5Networ
k Qt5OpenGL Qt5Positioning Qt5PrintSupport Qt5Qml Qt5Quick Qt5Sensors Qt5Sql Qt5
Svg Qt5WebKit Qt5WebKitWidgets Qt5Widgets
Updating Qt5WebChanneld.dll.
Updating icuin54.dll.
Updating icuuc54.dll.
Updating icudt54.dll.
Updating Qt5Cored.dll.
Updating Qt5Guid.dll.
Updating Qt5Multimediad.dll.
Updating Qt5MultimediaWidgetsd.dll.
Updating Qt5Networkd.dll.
Updating Qt5OpenGLd.dll.
Updating Qt5Positioningd.dll.
Updating Qt5PrintSupportd.dll.
Updating Qt5Qmld.dll.
Updating Qt5Quickd.dll.
Updating Qt5Sensorsd.dll.
Updating Qt5Sqld.dll.
Updating Qt5Svgd.dll.
Updating Qt5WebKitd.dll.
Updating Qt5WebKitWidgetsd.dll.
Updating Qt5Widgetsd.dll.
Updating libGLESV2d.dll.
Updating libEGLd.dll.
Updating D3Dcompiler_47.dll.
Creating directory audio.
Updating qtaudio_windowsd.dll.
Creating directory bearer.
Updating qgenericbearerd.dll.
Updating qnativewifibearerd.dll.
Creating directory iconengines.
Updating qsvgicond.dll.
Creating directory imageformats.
Updating qddsd.dll.
Updating qgifd.dll.
Updating qicnsd.dll.
Updating qicod.dll.
Updating qjp2d.dll.
Updating qjpegd.dll.
Updating qmngd.dll.
Updating qsvgd.dll.
Updating qtgad.dll.
Updating qtiffd.dll.
Updating qwbmpd.dll.
Updating qwebpd.dll.
Creating directory mediaservice.
Updating dsengined.dll.
Updating qtmedia_audioengined.dll.
Creating directory platforms.
Updating qwindowsd.dll.
Creating directory playlistformats.
Updating qtmultimedia_m3ud.dll.
Creating directory position.
Updating qtposition_positionpolld.dll.
Creating directory printsupport.
Updating windowsprintersupportd.dll.
Creating directory sensorgestures.
Updating qtsensorgestures_plugind.dll.
Updating qtsensorgestures_shakeplugind.dll.
Creating directory sensors.
Updating qtsensors_genericd.dll.
Creating directory sqldrivers.
Updating qsqlited.dll.
Updating qsqlmysqld.dll.
Updating qsqlodbcd.dll.
Updating qsqlpsqld.dll.
Creating D:\software\build-qtGuiTestApp-Desktop_Qt_5_5_0_MinGW_32bit-Debug\debug
\translations...
Creating qt_ca.qm...
Creating qt_cs.qm...
Creating qt_de.qm...
Creating qt_fi.qm...
Creating qt_fr.qm...
Creating qt_hu.qm...
Creating qt_it.qm...
Creating qt_ja.qm...
Creating qt_ko.qm...
Creating qt_lv.qm...
Creating qt_ru.qm...
Creating qt_sk.qm...
Creating qt_uk.qm...
D:\>
So looks good, since my project, although very simple, uses: core, gui, network, webkit, webkitwidgets
so yeah, a lot of qt libraries.
However when I run my executable I get the error that it can't find the following libs:
I manually added them from the same folder (D:\install\Qt\5.5\mingw492_32\bin\
) and it works fine. My questions are:
Without these questions answered, I find that this tool is a bit useless to me since I can do better myself.... I could probably script something up to keep running it and read the error and copy the relevant dll :o
edit
The following folders (with dll's) where added, but they only amount to 75mb... to be fair the nearly 1GB is due to webkit, quick, gui and other large Qt libs that I AM using:
mediaservice,
platforms,
playlistformats,
position,
printsupport,
sensorgestures,
sensors,
sqldrivers,
translations,
audio,
iconengines,
imageformats
These files should be copied if you specify the --compiler-runtime
flag, however it only works if you have g++.exe
in your path.
Also I have found that Qt is very over-cautious about which files to include on Windows. For a QtWidgets app the minimum you need is:
It comes to about 20 MB (8 MB zipped).
- Why does it miss these files?
these files are related to the mingw runtime library, they do not belong to Qt and that's why windeployqt does not add them by default.
- How can I make it get them?
in order to make windeployqt add them to the deploy directory, try adding the --compiler-runtime
switch to your command. Note that you should use the command prompt that Qt provides in its start menu shortcuts instead of locating windeployqt path yourself.
- 1GB of libs seemed a bit excessive to me, so I went around and deleted a few that I thought I don't need and my executable still runs fine. So how can you make windeployqt more efficient and just get the DLLs you need?
I think you are depending on too many modules in your project, so including all their dll files will have to be large, not sure however about the dll files that you exclude and how your program runs fine without them. maybe you can name some of the dll files that are not required. And of course you always have the option of static building (which will result in smaller and cleaner deployment size) as long as you don't break the license.
@Mike has already given comprehensive answers to your questions regarding windeployqt
. I'd like to address something that's not part of your core question, but is still very important:
- 1GB of libs seemed a bit excessive to me
The main reason your DLLs are so large is because you created a Debug build. Debug applications/DLLs contain lots of extra code and info that help you to debug your app. For example, if your program crashes, your debugger can print out useful information on where the crash occured and what steps led up to the crash. However, this extra code and info take up lots of space. You should not distribute Debug builds to your users.
If you create a Release build, your compiler will leave out all that extra debugging code and info, which significantly shrinks your DLLs. The compiler will also perform all sorts of optimizations that make your app run faster. Always create a Release build for others to download.
Final tidbit: Look at the Qt DLLs that your app is linked to. If their names end with a 'd' (e.g. Qt5Cored.dll
, Qt5Guid.dll
), that means they are Debug versions. The Release versions don't have the 'd' suffix (e.g. Qt5Core.dll
, Qt5Gui.dll
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With