windeployqt misses some of the libraries and gets others that are not required
- libgcc_s_dw2-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll
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:
- libgcc_s_dw2-1.dll
- libstdc++-6.dll
- libwinpthread-1.dll
- Qt5Core.dll
- Qt5Gui.dll
- Qt5Widgets.dll
- platforms/qwindows.dll
- YourApp.exe
It comes to about 20 MB (8 MB zipped).
@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
)
- 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.