After having searched and tried for hours, I could not get how to statically link the libraries to my exe. So I tried to copy the dependencies into the exe folder. I made a test program that changed the label on the click of a button. That was 14 mb. what should I do ? I am using icudt51.dll icuin51.dll icuuc51.dll libgcc_s_dw2-1.dll libstdc++-6.dll libwinpthread-1.dll Qt5Core.dll Qt5Gui.dll Qt5Widgets
3 Answers
There are many solutions to your problem:
1- Use Qt 4.8.5, there is not much difference between Qt 5 and Qt 4.8. It will help you because Qt 4.8.5 is not compiled with default support for QtWebkits, which means no dependency on icudt51.dll icuin51.dll icuuc51.dll files.
2- If you wish to use Qt 5, you will need to recompile it with webkit disabled, that will also get you rid of above dependencies. For details check this: post
If you want to link Qt 5.1.1 statically as-is (without 3rd party patches), it only works for the in-source builds. Shadow static builds fail due to a bug in zlib cloning. A upx-ed simple executable that only uses widgets will be under 5mb, more like 3mb. It's in the same ballpark for Qt 5 and Qt 4. I'm compiling both statically using MSVC2012 and it works just fine. Those are full static builds, meaning that Qt library is static and the C/C++ runtime is static as well. The only dependencies are on system DLLs. Makes life easy for everyone, although the release build can take a few minutes and forget about building on a 32 bit system.
The startup times of staticly-built executables are amazing. It's pretty much instantaneous :)