Qt Static Build on Windows with MinGW

Source: Building a static Qt for Windows using MinGW

Download Qt and install it. Also select toolchain MinGW:


Remember directory, where MinGW was installed. For example D:\Qt\Tools\mingw530_32\bin\

Download script windows-build-qt-static.ps1. Save it to directory D:\Qt\

Select Qt version from Qt Downloads and remember url for {VERSION}/{VERSION}/single/qt-everywhere-opensource-src-{VERSION}.zip. For example http://download.qt.io/official_releases/qt/5.9/5.9.1/single/qt-everywhere-opensource-src-5.9.1.zip

Create file windows-build-run.bat with content:

PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'D:\Qt\windows-build-qt-static.ps1' -QtSrcUrl 'http://download.qt.io/official_releases/qt/5.9/5.9.1/single/qt-everywhere-opensource-src-5.9.1.zip' -QtStaticDir 'D:\Qt\Static591' -MingwDir 'D:\Qt\Tools\mingw530_32' -QtVersion '5.9.1-Static'


  • -QtSrcUrl - Url to source codes archive;
  • -QtStaticDir - Directory where the static version are installed.
  • -MingwDir - Path to MinGW toolchain.

Run cmd.exe, change directory to D:\Qt\, start file windows-build-run.bat

If you see error about SQLite, open file windows-build-qt-static.ps1 in editor and replace -qt-sql-sqlite with -sql-sqlite.

Wait some hours.............

Add compiled Qt to Qt Creator: ToolsOptionsBuild & RunQt VersionsAdd.... Browse to qmake.exe.


Add new kit: ToolsOptionsBuild & RunKitAdd.... Select compiler C/C++ = MinGW 5.3.0, debugger = GNU gdb from MinGW 5.3.0 and just compiled Qt Version.


Select kit for project:


After build we could see a large executable file.

Posted in QtFramework on Jul 19, 2017