Compile a 64-bit version of Qt for windows

  • Tutorial
logoIn recent years, the cross-platform Qt library has received not only numerous improvements, but also its own QtCreator development environment and convenient installers for all operating systems. Now, for development, you don’t need to install the necessary environment yourself, prescribe paths, integrate the library into ide - just run the installer and everything will work out of the box. Unfortunately, the version for windows has an installer for 32-bit library and ide assembly only. And sometimes it becomes necessary to make a 64-bit application — most often this is due to the need to use other people's 64-bit components: loadable libraries, inproc com components, and other strange things. Under the cat contains detailed instructions on how to compile Qt and QtCreator from source for 64-bit architecture.


Warning


The assembly will take about 6 hours of time and 8 gigabytes of hard disk space :).

Install the compiler


For the debugger to work correctly in QtCreator, it is recommended to collect the compiler from Microsoft.
Download the SDK here , run the installer and install the entire “developer tools” branch (almost everything from there is used to build Qt).

Putting the source in a bunch


Download the sources of the last QtCreator 1.3 here and unpack the archive into
c:\qt\
Rename the unpacked folder to
2010.01.x64
Then download the sources of the last Qt 4.6 here and unpack the archive into
c:\qt\2010.01.x64
Rename the unpacked folder
qt
Here you need to take into account that during compilation the folder names will be compiled into qmake and you won’t be able to change them. The folder names I have given correspond to where Qt installs the installer under windows.

Assembly


Launch
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\Visual Studio 2008 x64 Win64 Command Prompt.lnk

In the console that opens, we sequentially execute: the configure.exe call creates a makefile for assembling everything by the microsoft compiler (the compiler will be detected automatically, since we work in visual studio command prompt - environment variables with us). “O” will choose the type of open source license (free), “y” will confirm the agreement with the license. The nmake call is actually a microsoft utility for reading the makefile and compiling what is needed and what is not needed. After nmake has worked (and this is several hours), we do not close the console and copy all .pdb files somewhere to a temporary folder. Due to a bug in the makefile, they will be erased when deleting temporary files. Then we continue in the console: Without closing the console, copy all .pluginspec files from the temporary folder

cd c:\qt\2010.01.x64\qt
configure.exe
o
y
nmake




c:\qt\2010.01.x64\qt\lib


nmake clean
set PATH=%PATH%;c:\qt\2010.01.x64\qt\bin
cd c:\qt\2010.01.x64
qmake "CONFIG+=release" -r
nmake release



c:\qt\2010.01.x64\lib\qtcreator\plugins\nokia
This is also a bug in the makefile. Then we continue in the console: After everything has been compiled, move the .pdb and .pluginspec files back. QtCreator is compiled in the release version, since the debug build will be launched as a command-line application with a fixed console.

nmake clean




Filed


After everything is successfully assembled, all .dll files at the end of which there is no name “d” are copied from the folder
c:\qt\2010.01.x64\qt\bin
to the folder.
c:\qt\2010.01.x64\bin
QtCreator development environment starts as
c:\qt\2010.01.x64\bin\qtcreator.exe
before calling it, you need to call it in order for QtCreator to work correctly with the Microsoft compiler and debugger. Launch QtCreator, select Tools-> Options-> Project, uncheck “Use jom”. You can not remove it in principle, but then this same jom will need to be downloaded and copied to “bin”. Click "Apply." Then select Tools-> Options-> Qt4-> QtVersions, click on the “+” in the upper right corner, in the field “Version Name” write “Qt 4.6.0 x64”, in the field “QMake location” write
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat





“C: \ qt \ 2010.01.x64 \ qt \ bin \ qmake.exe”, set “MSVC Version” to “9.0”, in the field “Default Qt Version” select “Qt 4.6.0 x64” and click on the “Rebuild” button ". Choose Tools-> Options-> Help-> Documentation, click “Add” and add all .qch files from c: \ qt \ 2010.01.x64 \ qt \ doc \ qch

That's all. Creating, editing, assembling and, best of all - debugging 64 bit Qt programs for windows at your service. I say goodbye to sim and wait for comments. If you have questions, I’ll try to answer. If you have something to tell (maybe in vain I did all this and ready-made installers are already in the open spaces of the network :) - I will be grateful.

Updated 06.27.2010


To build with the recently released Visual Studio 2010 SDK, you must run configure.exe with the key
-platform win32-msvc2008
It is advisable to use the latest version of Qt from GIT and brunch 2.0 Qt Creator from there.
git clone -b 2.0 git: //gitorious.org/qt-creator/qt-creator.git c: \ qt \ qt-creator.latest

Before starting, you need to install perl and replace the fragment "QMAKE_CFLAGS_RELEASE = -O2 -MD" with "QMAKE_CFLAGS_RELEASE = -Od -MD" in qt / mkspecs / win32-msvc2010 / qmake.conf.

Profit?


QtCreator


Also popular now: