Build static QT 5.1 on Windows

So I needed to built QT statically for my cube world server app as otherwise the injected DLL would crash and building it statically just seemed like a better option with not having to deploy several separate library’s with the core application. However, reading through many (dated) tutorials all I could manage to summon were some generic errors, eventually I managed to find a straightforward and simple solution which I thought I should post to help out anyone wanting to build the latest 5.1 release.

Before you go any further make sure you have visual studio 2012 installed, the express version wont work so if you have that already you’ll need to upgrade.

1) Download the QT source – I got mine from HERE

2) Extract the whole contents to somewhere e.g “C:\Qt\” so you end up with “C:\Qt\qt-everywhere-opensource-src-5.1.0”

3) Install the DirectX SDK – Download HERE. If you get the error “S1023” on install load up a command prompt and enter the following and try again.

MsiExec.exe /passive /X{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}
MsiExec.exe /passive /X{1D8E6291-B0D5-35EC-8441-6616F567A0F7}

4) Once installed go to the DirectX SDK install directory (C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)) then “Utilities” then “bin” so you’ll end up somewhere like this “C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin”

5) you should now see a file called “dx_setenv.cmd” right click this and run as admin, this will setup the path to our DirectX install.

6) Now download Jom from HERE and extract it to the main qt source directory we extracted earlier so “C:\Qt\qt-everywhere-opensource-src-5.1.0”

7) Next open up a new Visual Studio command prompt (can be found under the visual studio tools folder in the start menu) and navigate to the previous source directory where we just extracted jom to

cd C:\Qt\qt-everywhere-opensource-src-5.1.0

8) Enter the following line and press enter, this will set up our build config

configure -debug-and-release -static –opensource -opengl desktop -nomake examples -nomake tests

9) Finally type jom press enter then wait, this might take a while but once its done you should have a fully working static QT build under the “qtbase” directory!


Leave a Comment