Statically Linking Qt Applications on Linux

This article constitutes the second part of Building Qt for Static Linking which demonstrates how to actually compile your Qt application statically against the Qt libraries. This part will be relatively straight forward considering that the hard part of configuring Qt for your needs is already done.

When using self-built versions of the Qt libraries you will need to rerun qmake against your project in order for it to create a Makefile which uses your newly generated Qt library. Assuming you are using the default install path, the following set of commands will rebuild your Qt application using your new library.

make clean

You simply run the qmake binary installed with your new Qt library which has already been pre-configured from the install process, and writes a new Makefile for you accordingly. Then it’s as simple as cleaning all old binaries and rebuilding your project. Once finished, you will have a binary version of your project which is statically linked to the Qt libraries.

Filed under:
Tags: , , ,

No Responses to “Statically Linking Qt Applications on Linux”

Leave a comment