views:

2219

answers:

6

Does anyone have instructions on building the opensource version of QT? Now that the repository is opened up, I'm trying to build for VS2008 but I'm getting errors when it tries to build qmake.

I found the question http://stackoverflow.com/questions/74521/im-looking-to-use-visual-studio-to-write-and-compile-using-the-open-source-versi but this information is out of date, and doesn't really help me. For reference, here's what happens when I try to build with configure -platform win32-msvc2008

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl -c -Foproject.obj  -W3 -nologo -O2  -I. -Igenerators -Igenerators\unix -Igenerators\win32 -Igenerators\mac  -
IC:\dev\open_source\qt\include -IC:\dev\open_source\qt\include\QtCore  -IC:\dev\open_source\qt\include -IC:\dev\open_sou
rce\qt\include\QtCore  -IC:\dev\open_source\qt\src\corelib\global  -IC:\dev\open_source\qt\include\QtScript  -IC:\dev\op
en_source\qt\mkspecs\win32-msvc2008   -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NODLL -DQT_NO_STL
  -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUILD_QMAKE -DQT_NO_THREAD  -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -D
QT_NO_DATASTREAM -DQT_NO_PCRE -DQT_BOOTSTRAPPED   -DQMAKE_OPENSOURCE_EDITION project.cpp
project.cpp
c:\dev\open_source\qt\src\corelib\tools\qstringlist.h(45) : fatal error C1083: Cannot open include file: 'QtCore/qalgori
thms.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
Building qmake failed, return code 2
+4  A: 

This blog article seems to have more recent information on building Qt with visual studio. Hope it helps.

Arnold Spence
+3  A: 

Well, one helpful thing is to run configure inside the Visual Studio Command Prompt. That should be available in the Visual Studio start menu group under Visual Studio Tools.

Also now when you run configure you don't have to specify target platform, because it will be set as an environment variable by the VS Command Prompt.

I got errors from configure and nmake when I did not use the VS Command Prompt, and since switching I have not had any issues.

So the simple instructions would be:

1) open VS command prompt

2) navigate to qt folder where configure.exe is located

3) configure

4) nmake

Chris Cameron
Thanks, that did the trick. It wasn't enough to run vcvarsall.cmd apparently.
kevin42
+4  A: 

Please, ensure that you have ActiveState Perl installed

I thought this was a joke, it seems to be true! check post N:14: http://www.qtcentre.org/threads/23529-Building-Qt-4.6-on-Windows-(msvs-2008)
karatchov
+1  A: 

Also, if you simply want to compile with MSVC so you can develop with the open source libraries with visual studio, I put together a project to provide "pre-built" Qt LGPL libraries with MSVC 2008.

It might be helpfull and has the advantages of taking up less space then compiling it yourself. It also provides a command prompt with all your environment variables set up for you and a link to launch Visual Studio with a Qt environment. It's called qt-msvc-installer.

gabeiscoding
+2  A: 

Note that Nokia, as of Qt 4.6, is now providing their own open source VS builds of Qt, so it is no longer necessary to build from source yourself to do development with Visual Studio. Access their open source download page, and look for builds named (e.g.) qt-win-opensource-4.6.1-vs2008.exe.

Stephen Schaub
A: 

What user156973 said. Install ActiveState perl and run configure again.

Dan G