This is an update to my previously published post Building Qt 5.2.1 on Windows 7 with Visual Studio 2010.
Not much has changed for me: I’m still running Windows 7 (Windows 10 can wait a bit longer) and Visual Studio 2010 (I’ll probably switch to version “2017” when it’s done — and if it still runs under Win7).
But what did change is that The Qt Company put out a new Long Term Support (LTS) release in the meantime: Qt 5.6.0 has officially seen the light of the day in March 2016, and the 5.6.x branch shall be supported for the next three years.
Since I’m rarely relying on brand-new features, that’s fine with me: Better tried and true then cutting my fingers on the bleeding edge of progress 😏 .
Additionally, newer releases of the Qt framework dropped support for older compilers, including Visual Studio 2010. I plan to upgrade some time in the future (see above), but at the moment that means that there isn’t much room for me to move elsewhere, anyway.
At the time of writing this, 5.6.2 was the current version… and no pre-compiled package for Visual Studio 2010 was available.
Prerequisites and recommended installation order
- Microsoft Visual Studio 2010
- Microsoft Windows SDK 7.1
- Microsoft Visual Studio 2010 Service Pack 1 (needed for a 64-bit build)
- Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1
- Python (a new requirement, compared to my last post)
Tools like Perl should be in PATH for the command prompt build environment.
You might also want to read Pavel Holoborodko’s _How To Compile Qt [4.7] with Visual Studio _ for some background information and understanding.
Getting and building Qt
Again, the download of the plain source code for older/not-mainstream versions is very well hidden on the Qt site (and I’m not going to clone the repositry with git or similar, just downloading the sources, thankyouverymuch).
Try to get it as a zip filefrom this location.
Extract it to an appropriate place, e.g.
C:\devel\ext\Qt\5.6.2\(if your extraction tool puts it into a sub-directory named qt-everywhere-opensource-src-5.6.2 then move the content one level up and delete this folder).
Build 64-bit DLLs with Visual Studio 2010 (for 32-bit files, adjust paths, names, and options accordingly):
Open the Visual Studio x64 Win64 Command Prompt (2010) from the start menu and navigate to
configureto set up the build, for example with these parameter values (note that this is a setup that works for me, but I use Qt currently only for certain projects with specific needs; you may need different features enabled/disabled, etc.):
To get rid of the question whether you agree to the license.
Target directory, e.g. a full path like C:\devel\ext\Qt\5.6.2_64DLL
Creatings DLLs instead of static libraries.
Use Microsoft Visual C++ 2010.
Use multiple processors for compiling with Microsoft Visual C++ (-MP).
For lupdate/linguist/lrelease and so on (the old workaround is no longer required).
Because examples (esp. OpenGL ones) messed up the build.
Library for Unicode and Globalization support. This would be required for building Qt WebKit.
But Qt also supports Unicode by default and ICU seems to be on the way out for Qt’s future…
ANGLE would translate OpenGL calls into DirectX calls.
Other changes to the configuration since my run with for 5.2.1:
-skip qtwebkit-examplesare no longer necessary because “With Qt 5.6 the [QtWebKit] modules are no longer part of the release packages, but users can still build them from source." source “New Features in Qt 5.6: Removed Modules”].
The Chromium-based QtWebEngine is the (heavier) replacement for it, but isn’t built using the above configuration either (and building it might be tricky, according to some older posts…).
nmaketo kick-off the building process (to clean up configure after a failed build, use
nmake installto move the built binaries to the target directory.