Building static Qt 5

This is a detail guilde how to build the static version of the Qt framework. Static build of Qt allows you to build solid applications which will work without lots of additional *.DLL/*.SO or *.DYLIB files because everything will be hardcoded into your application.

Introdution
Static version of Qt allows you to build solid application files without packing of a lots of dependent libraries.

''Don't forget that with static version of Qt you can legally release your applications if there are Open-Source! (With GPLv3 license). If you wants to use static Qt build in commercial development of closed-source applications, you should buy commercial license for that purpose.''

Download
At first, you must to download entire source code tarball from official Qt site:

Download Qt 5.5.1 tar.gz Note: if this link is outdated, you can find newer version of Qt sources here:

Qt open-source Download page

Unpacking
Unpack everything from the tarball into any folder (on Linux or on Mac OS X):

Removing of glitchy Jasper library
This library provides JPEG2000 image format support, but in the PGE it is useless (main image formats in the PGE are PNG, GIF and BMP), and also causes a random crashes of Qt applications built with your Qt build.

To resolve next issues, recommended to remove building of JPE support: because disabling of JPE building is not provided by ./configure script given with Qt sources, we must remove building of JPE weself:
 * make a kill_jasper.sh file in parent folder of Qt sources folder
 * on OS X: install via homebrew the coreutils and gnu-sed
 * open a text editor ( On OS X: Don't use TextEditor.app, because it makes invalid code!, use text editor from XCode or use nano) and paste next content into it:
 * open command line and execute this script by "bash ./kill_jasper.sh" command

Same for OSX with gnu-sed:

Configure
Open console then change current directory to new folder which you has been unpacked. then Copy-paste this into console ans press ENTER:

Linux Mint / Debian

Mac OS X

then wait while configuring will be finished (you will need to wait ~30...60 min)

Build
(you will wait ~1.2...2 hours)

Installation
(you will wait ~10..30 min)

Usage
Built Qt will be located at ~/Qt/5.5.1_static or ~/Qt/5.5.1_static_osx on Mac OS X. To configure your Qt application to be built with static Qt version, you need to call ~/Qt/5.5.1_static/bin/qmake while you in your project folder, and other steps are same as you build with regular Qt version.

If you wants to plug static build of Qt into Qt Creator, just make a new toolchain with your default compiler (GCC, CLang or MinGW on Windows systems) and debugger, and with your static build of Qt (find QMake in the bin subdirectory of your static Qt build)

Note: Carefully transfer packages with a static build of Qt, you should keep same absolute path (because it is hardcoded) if you don't want to rebuild Qt again.