JPz'log Coin Coin and Plop da Plop

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 :-)

  1. You will need to recompile Qt, so run configure with the -static option. You should also remove the support for rtti and C++ exceptions. You can also gain some space by removing the themes but the windows and windowsxp ones.
  2. ... but before you compile anything, edit mkspecs/win32-g++/qmake.conf and 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.
  3. Run make sub-src and go drink a few coffees.
  4. You can go back to your Qt application, run qmake then make. Make sure you had static in your QMake file configuration.
  5. 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.

Share this post:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Live
  • Netvibes
  • StumbleUpon
  • Technorati
  • FriendFeed
  • Wikio
  • Twitter
  • Identi.ca
  • Reddit
  • RSS
  • Slashdot

Related posts:

  1. IzPack native launcher 2.2 released
  2. Exporting a DotClear v1 blog to static HTML files
  3. Experimental Qt-based native launcher
  4. 7-Zip and the IzPack launcher
  5. Qt 4.0 available for Win32 under the GPL

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.

JPz'log is Digg proof thanks to caching by WP Super Cache