I wrote a static linking guide
and How to build Qt static with multiple compilers and keep it small
(because it can get quite large, especially for simple programs). You can also check out the BitRock installer, which is free for open source projects.
In short, it turns out to be a little more complicated if you use something that Qt considers a plugin, for example, support for most types of images (JPEG, GIF) or databases. For example, if you want to include support for Oracle and GIF images for your icons, you add the following to your .PRO file:
QTPLUGIN += qsqloci qgif CONFIG += static
Then you need to:
#include <QtPlugin>
in your project and import any used plugins. You need to change this order of settings so that it can be compiled using dynamic linking (for example, when debugging or adding features), although this can be easily automated. There are also considerations when building Qt libraries for use with static linking, although Qt instructions will at least start working.
Charles Burns Oct 31 '09 at 16:17 2009-10-31 16:17
source share