20Feb/070
Qt static linking and removing the mingw dll dependency
For the development of the IzPack Java installer native launcher, I have been facing a tricky issue regarding the compilation. Indeed, I wanted to get a single executable with no dll dependencies, but somehow never managed to get rid of the one on a MingW dll. I finally found a solution somewhere on the net
- You will need to recompile Qt, so run
configurewith the-staticoption. You should also remove the support for rtti and C++ exceptions. You can also gain some space by removing the themes but thewindowsandwindowsxpones. - ... but before you compile anything, edit
mkspecs/win32-g++/qmake.confand remove the-mthreads. This is actually why you get this stupid MingW dependency. Please note that the build may break if you still have the rtti and C++ exceptions support built-in. - Run
make sub-srcand go drink a few coffees. - You can go back to your Qt application, run
qmakethenmake. Make sure you hadstaticin your QMake file configuration. - The executable can be large (about 5MB), so do not hesitate to run UPX on it.
With my trimmed-down Qt build, I am getting a UPX-compressed standalone executable of 1,94MB.
Related posts:
- IzPack native launcher 2.2 released
- Exporting a DotClear v1 blog to static HTML files
- Experimental Qt-based native launcher
- 7-Zip and the IzPack launcher
- Qt 4.0 available for Win32 under the GPL

