2010-02-17

Build Qt as Static Library

Your Qt applications could be smaller and most importantly can be distributed as a single executable, if it is statically linked with Qt library.

A static built Qt application is faster. According to the artical "Qt Performance Tuning":

"A lot of CPU and memory is used by the ELF (Executable and Linking Format) linking process. Significant savings can be achieved by using a static build of the application suite; rather than having a collection of executables which link dynamically to Qt's libraries, all the applications is built into into a single executable which is statically linked to Qt's libraries."

First of all, you need to build Qt as a static library. See the thread http://lists.trolltech.com/qt-interest/2003-05/thread00396-0.html
./configure -thread -static  (makes libqt-mt.a)
./configure -static (makes libqt.a)
./configure (makes libqt.so)
./configure -thread (makes lib-mt.so)
Then, add the necessary plugins. See the artical http://doc.trolltech.com/4.6/plugins-howto.html#static-plugins.

Finally, deploy your application. See the artical http://doc.trolltech.com/4.6/deployment.html.

References:

No comments:

Post a Comment