📜 ⬆️ ⬇️

Qt5 build in Visual Studio 2012 or I can sew a kangaroo eye while my favorite ketchup flows

Not so long ago a new Qt came out, promising a great and bright future, and I decided to try out this miracle. But to get started with this miracle, I needed to build it for my installed studio of 2012 from the source files. And the assembly turned out to be far from trivial (although no one has canceled the curvature of my arms — students like me need to straighten the fence).

As soon as a stable version of the new Qt5 came out at the end of last year, I decided to download and try it, but unfortunately, the assemblies that I needed, namely, for the Windows platform, the assemblies for MinGW and Visual Studio 2012 were missing from site qt-project.org . Therefore, I downloaded and installed the finished build for my Linux: Ubuntu 12.04. True, I already made attempts (more correctly attempts) to compile at least for the MinGW library from the sources. However, everything turned into failure, frustration and deep depression.

At the end of January, the developers pleased us with version 5.0.1, corrected and compiled to work with MinGW 4.7. However, for VS2012, they again did not post the assembly. And then I decided it was worth trying again, but what if it turns out?

In search of information on the Internet, I came across a few articles on the assembly, but not under VS2012. The most truthful, in my opinion, was the version on the official wiki page of the project, no matter how strange it might sound. Therefore, I will try to describe the whole process once again here, commenting on and adding my own, necessary, in my opinion, assembly points. I decided to take a chance and collect the fullest possible library.
')
What is necessary:



The remark, for some reason unknown to me, python version 3.3.0 gave an error when translating files, although the developers declared the efficiency of the new python, so I had to install version 2.7.

My actions even seem to me to be strongly shamanic, so I will try to describe in detail my inept steps, since I’m not really looking for a chance to rebuild this whole machine again — time and nerves are pitiful. I hope that someone will take to collect too, and tell you what did not work out of my method, and with the common knowledge “we will finish”, so to speak, this miracle. I recommend that you first read the entire article in order to avoid minor misunderstandings during assembly.

So, let's begin.

My system is Windows 8 Pro with Media Center x64. Notebook brand eMachines E732ZG. Brief specifications: Intel Pentium P6200 (dual-core) 2.13 GHz on each core, 6 GB DDR3 RAM, 320 GB HDD. The version of Visual Studio 2012 Ultimate Update 1. Kaspersky Internet Security 2013 was turned off at the time of assembly.

I installed all additional programs in C: \ Development \. ICU was downloaded not on the official site, but on another one, but the build for vs2012 was posted there.

The Qt5.0.1 source files were unpacked in the same folder:

C:\Development\qt-everywhere-opensource-src-5.0.1

During installation, checkboxes were selected for writing perl, ruby, and python to the PATH environment variable. I think that the variant of their manual registration in the command line, in which we will collect, will also fit:

 set PATH=C:\Development\Perl64\bin;C:\Development\Python27;C:\Development\Ruby193\bin;%PATH% 


We start Command Prompt VS 2012 (I started on behalf of the Administrator). This thing prescribes all of its own on the way, so we launch it. The batch file itself is located in
«C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\VsDevCmd.bat» .
Then in it we set the following variables:

 set CL=/MP set INCLUDE=C:\Development\icu-50.1.2-shared-vs2012\include;%INCLUDE% set LIB=C:\Development\icu-50.1.2-shared-vs2012\lib;%LIB% set PATH=C:\Development\icu-50.1.2-shared-vs2012\bin;%PATH% 


With the set CL=/MP command, we most likely indicate to the nmake utility that we have several kernels: "Therefore, please parallelize the compilation tasks."

Next, go to the sources folder itself:

 cd C:\Development\qt-everywhere-opensource-src-5.0.1 

I think the following steps should be done right away, because otherwise the qtwebkit build fails, or rather it does not work:

 set PATH=%PATH%;%CD%\gnuwin32\bin cd .\qtwebkit set WEBKITOUTPUTDIR=%CD%\WebkitBuild cd ..\ 


By the way, the set WEBKITOUTPUTDIR=%CD%\WebkitBuild under the big question, do you need it here? It was taken from the manual on a separate qtwebkit compilation.

You can verify the correctness of all paths by typing the following:

 set INCLUDE && set LIB && set PATH 


By the way, you can make a batch file from these commands and run it using the same Command Prompt 2012.

Configuration

Now you need to configure the assembly. To do this, type the following, being in the directory C:\Development\qt-everywhere-opensource-src-5.0.1\:

 configure -prefix C:\Development\Qt\5.0.1_MSVC2012\qtbase -opensource -platform win32-msvc2012 -debug-and-release -shared -c++11 -nomake examples -nomake tests -icu -confirm-license 




The remaining configuration parameters can be found by typing:

 configure -help 


There will either be mistakes that are still easy to fix (there are not enough paths or libraries), or everything will be fine. The process takes no more than 10 minutes.

Compile and install

Further, all less joyful. Just run the nmake command and smoke, drink tea, cook, sleep, etc. After many hours of assembly (or multi-day), you can run the nmake install command. It will copy your library to the specified directory in the -prefix parameter.

Experience

I was even sadder. Initially in PATH was a python version 3.3, but I didn’t do this thing:
set PATH=%PATH%;%CD%\gnuwin32\bin

I do not know how long the build lasted, an hour, two or more, but when I tried to build qtwebkit, the nmake utility nmake out due to the lack of some kind of win_flex . I was crazy because it was my third attempt to build the entire library with qtwebkit , and just entered nmake install . The library was copied, but not completely. Again fell out when trying to copy an uncompiled qtwebkit .

At this point, my studio has already installed the Visual Studio Add-in 1.2.0 for Qt5 extension . In the settings, I indicated the path to the library installed in half. Created the first trial application, but after a successful build but refused to start due to the absence of three .dll from icu . I had to add the path C:\Development\icu-50.1.2-shared-vs2012\lib in the PATH and restart the studio, as a result, everything starts in the studio without any problems. QtCreator, after setting up this library, refused to launch successfully built applications normally. For some reason they flew with an error. Running the assembled application from the build directory turned out to be missing D3DCOMPILER_46.dll. I don’t know what to do with it. I would be glad if you tell me.

Then I began to look for ways to assemble this sad module, and came across such an instruction:

 set PATH=%PATH%;%CD%\gnuwin32\bin cd .\qtwebkit set WEBKITOUTPUTDIR=%CD%\WebkitBuild perl Tools\Scripts\build-webkit --qt --qmake=”%CD%\\..\\qtbase\\bin\\qmake.exe” --install-libs= (install der) --release --makeargs=%MAKEFLAGS% 


But nmake now quarreled with MAKEFLAGS . Launched without this argument:

 perl Tools\Scripts\build-webkit --qt --qmake=”%CD%\\..\\qtbase\\bin\\qmake.exe” --install-libs= (install der) --release 


However, now nmake began to complain about the absence of MainThreadQt.moc . Therefore, I entered nmake clean and went to the qt shared folder. Already from there I launched nmake (now %CD%\gnuwin32\bin added to the path ), and, miraculously, it works, IT IS GOING TO. And from the moment he fell out (he checked that the collected ones already exist and reached the first unassembled). True, after a while he fell out again. Now let me down python version 3.3. Somewhere on the Internet I read that it is worthwhile to install version 2.7, which I did. Restarted the command line after installing and replacing the path to python in the PATH variable. I re-registered all the set and entered nmake . He continued his work.

Now I sit waiting for the past hour of the end of the whole epic. The last action began at about 14:00 Moscow time, somewhere at qtwebkit\webcore he finished qtwebkit\webcore version and began to “cook” release object handlers, which will take the same time. Plus, there, apparently, was not yet collected the entire library. I hope that over the next night everything will be done.

At the time of writing the main part of the article, nmake collecting qtwebkit for about 8 hours in a row. It has now been more than a day since the last launch of nmake . I hasten to rejoice (perceived in two ways) - in a day and 6 hours he collected qtwebkit , another 2 - 4 hours were spent at the very beginning on assembling the main library. Another 2 - 3 hours was spent on additional utilities, such as QtDesigner , Linguist and Assistant . The assembly was completed successfully, without failures. The folder with the source files has grown from 700 - 800 MB to 10 GB!

Then I run nmake install. Copied forty minutes. As a result, the C:\Development\Qt\5.0.1_MSVC2012\ weighs 1.22 GB. Through Visual Studio Add-in 1.2.0 for Qt5 to VS2012, everything “clings” remarkably, only one problem, all Qt compiled applications, even QtDesigner require some kind of D3DCOMPILER_46.dll . I found it at C:\Program Files (x86)\Windows Kits\8.0\Redist\D3D\x86\ . And also required the library icudt50.dll , icuin50.dll , icuuc50.dll , which are located in C:\Development\icu-50.1.2-shared-vs2012\lib .

For some reason I do not understand, the designer and assistant from this assembly do not start, even after manually adding the D3DCOMPILER_46.dll to them. Can someone have something to say about this?

PS I hope that this article will help you, and you will spend less time figuring out the causes of inoperability.

Source: https://habr.com/ru/post/168671/


All Articles