Build Qt Statically for Linux

Posted on Posted in Qt Tutorials, Tutorials

In this post I’ll describe how to build a static version of Qt under Linux (Ubuntu flavor) and I will use Qt 5.7.0 and Ubuntu 16.04 64-Bit for that matter. Static builds ease the process of app deployment under Linux cause it is quite complex (much more complex than Windows and Mac OS X) so without further ado, here it is.

First you need to download Qt sources from the following link:

You usually need to get the latest sources and single module that contains all sources. In my case (Qt 5.7.0) it was here.

Download and extract it. (note that you might need to install p7zip if you don’t have it already)

Let’s say you extracted the sources in the folder below:


Open up a terminal and enter the following commands:

cd Downloads/qt-everywhere-opensource-src-5.7.0

Next enter the following command and note that you need to replace “/home/amin/Qt570static” with your own folder for Qt build:

sudo ./configure -static -prefix “/home/amin/Qt570static” -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -qt-xcb -opengl desktop -qt-sql-sqlite -make libs -nomake tools -nomake examples -nomake tests

You will be asked to choose the edition of Qt. Type “o” to select the open source edition and press enter to proceed.

Then you will be asked to confirm the license. Type “yes” and press enter.

When configuration’s done, type the following command:

sudo make

Now wait for awhile. Maybe quite a while if you use an old laptop for Linux development, like me.

After the build is finished, enter the following final command to get your static build kit under “/home/amin/Qt570static” folder that you provided to configure command.

sudo make install

Voila, it’s done. You have your Qt static build.


Leave a Reply

Your email address will not be published. Required fields are marked *