How to build Qt 5.1.1 using Visual Studio 2012 under XP
Introduction
This article is nothing supernatural. I just wanted to bring together all the nuances and problems that I encountered, related to the construction of Qt in one article - all of a sudden someone will come in handy. The task was primarily to get rid of problems with sound under XP, by using dsengine as an alternative to a self-written audio playback plug-in (based on ffmpeg), and for Windows Vista + you can fully use wmfengine. Therefore, the choice fell on version 5.1.1. I was also aiming to get a more advanced version of the C ++ 11 language, so I built it under Visual C ++ 11.0 (x86). There are no problems with the x64 version of the library; it can be downloaded from the official website. Also in the title of the article there is “XP” - because it was on this operating system that problems arose.
utilities from the folder in the gnuwin32 archive root
Microsoft DirectX SDK (for compiling qt 5 DirectX SDK is required - it should not be installed if there is Microsoft Visual C ++ 2010 x86 / x64 redistributable - 10.0. ( Number over 30319 ))
As a result, we get the following bat-file vars32.bat :
REM For fast compiling set CL=/MP REM include set INCLUDE=e:\share\_open_source_\icu-51.2-vs2012\include\;e:\share\_open_source_\pthreads\include\;%INCLUDE% REM lib set LIB=e:\share\_open_source_\icu-51.2-vs2012\lib\;e:\share\_open_source_\pthreads\lib\x86\;%LIB% REM tools set PATH=e:\share\_open_source_\icu-51.2-vs2012\bin\;C:\Ruby200-x64\bin;%CD%\gnuwin32\bin\;C:\Python27;C:\Perl64\bin;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86;%CD%\qtbase\bin\;e:\share\_open_source_\pthreads\dll\x86\;%PATH%
check that we have Visual Studio has at least one update
pay attention to typo in the paths (v7.1A)
Do not forget about running the script for the utility nmake with the parameter
we finish vars32.bat :
… REMfor nmake CALL "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 REMfor XP set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Include;%INCLUDE%setPATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Bin;%PATH%set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Lib;%LIB%set CL=/D_USING_V110_SDK71_;%CL%
Since this may not be sufficiently modifying the Qt configuration files: a) File qtbase \ src \ corelib \ io \ qfilesystemengine_win.cpp , line 574 , change to
Otherwise, because of the declared directive _USING_V110_SDK71_ , it will not succeed b) The qtbase \ qmake \ Makefile.win32 file in the variable CFLAGS_BARE add on -DUNICODE -D_USING_V110_SDK71_ c) The qtbase \ mkspecs \ win32-msvc2012 \ qmake.conf file , to the QMAKE_CFLAGS variable:
-no-angle - since my project uses OpenGL “directly”, I have problems with ANGLE (http://qt-project.org/wiki/Qt-5-on-Windows-ANGLE-and-OpenGL). In short, as I understood it, this is an additional abstraction over the OpenGL API, that's why I had problems with entities of the same name.
-mp - same as CL = / MP - for faster compilation
-no-audio-backend - without wmf media service
-opengl desktop - build with opengl support for desktop applications
-skip qtwebkit and -skip qtwebkit-examples - don’t spoil your mood collect them later, this is a developer bug
-skip qttranslations - I excluded because if you take version icu version 50 then lrelease.exe will throw out an error. This module in my opinion is not so important, therefore, we will also collect, but then.
-prefix "c: \ dev \ building_qt \ bin \ x86" - path to the built libraries
-nomake tests -nomake examples - exclude and save time (even on my work computer, an assembly without a webkit takes 30 minutes)
I also recommend using jom (http://qt-project.org/wiki/jom). A small utility that distributes nmake work to threads whose number equals the number of cores. For example, I have an i7 with ostensibly 8 cores - accordingly there will be 8 threads
You can write it in the paths and use the convenient editor of environment variables repidee ( www.rapidee.com/ru/about ). Do not forget to restart the command line, so that the changes take effect
And so the assembly. Run cmd.exe in the root folder of the unpacked archive and type:
Run qmake (from qtbase / bin) to configure some module and get a makefile for nmake. So you can for example download an additional module to configure and build.
For qttranslations, we don’t forget about icu version 51. I can also notice that Qt applications may fall for this reason. To check the correctness of icu operation, for example, you can try to call QTextCodec :: codecForName (“CP1251”) , if you managed to get the codec, all is well.
I had to finish qtwebkit / bridge api - the transfer of QtRuntimeObject parameters from JS to C ++ does not work, and apparently for a long time.
If the application does not run under XP, then you need to see the dependencies via depends (http://www.dependencywalker.com/). Most likely forgot about msvcp110.dll and msvcr110.dll .
Thanks for attention! I hope someone will come in handy. My application works great.