Difference between revisions of "Documentation/4.0/Developers/Build Instructions/Prerequisites/Qt"

From Slicer Wiki
Jump to: navigation, search
(Prepend documentation/versioncheck template. See http://na-mic.org/Mantis/view.php?id=2887)
 
(41 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
<noinclude>{{documentation/versioncheck}}</noinclude>
 
= Binary vs build-from-source ? =
 
= Binary vs build-from-source ? =
  
Line 5: Line 6:
 
== Linux  ==
 
== Linux  ==
  
* Using [[#Download_links|binary]] works great for both '''Debug''' and '''Release''' build of Slicer. See [[#Download_links]]
+
* Using [[#Download_links|binary]] works great for both '''Debug''' and '''Release''' build of Slicer. See [[#Download_links]] and [[#Installation_instruction]]
  
 
== Mac  ==
 
== Mac  ==
  
* Using [[#Download_links|binary]] works great for both '''Debug''' and '''Release''' build of Slicer. See [[#Download_links]]
+
* Using [[#Download_links|binary]] works great for both '''Debug''' and '''Release''' build of Slicer. See [[#Download_links]] and [[#Installation_instruction]]
  
 
== Windows  ==
 
== Windows  ==
Line 15: Line 16:
 
=== Debug (32 and 64-bit) or Release (64-bit) ===
 
=== Debug (32 and 64-bit) or Release (64-bit) ===
  
* You have to build Qt from source. See [[#Download_links]]
+
* You have to build Qt from source. See [[#Download_links]] and [[#Installation_instruction]]
  
 
* '''Details''': Using the Qt Designer on Windows requires that the Slicer plugins are [http://doc.trolltech.com/4.6/deployment-plugins.html#debugging-plugins|compiled in the same mode as Qt]. If Qt was compiled in Release mode (default), Slicer would have to be compiled in Release mode as well. However if Qt is compiled in Debug mode only, Slicer has to be compiled in Debug too. When Qt is in "Release and Debug" mode only the Release version of Designer.exe is generated, Slicer would have to be compiled in Release. So for developers, the <b>Debug mode is recommended</b>, this is why we detail the compilation of Qt below.
 
* '''Details''': Using the Qt Designer on Windows requires that the Slicer plugins are [http://doc.trolltech.com/4.6/deployment-plugins.html#debugging-plugins|compiled in the same mode as Qt]. If Qt was compiled in Release mode (default), Slicer would have to be compiled in Release mode as well. However if Qt is compiled in Debug mode only, Slicer has to be compiled in Debug too. When Qt is in "Release and Debug" mode only the Release version of Designer.exe is generated, Slicer would have to be compiled in Release. So for developers, the <b>Debug mode is recommended</b>, this is why we detail the compilation of Qt below.
Line 21: Line 22:
 
=== Release (32-bit) ===
 
=== Release (32-bit) ===
  
* Using [[#Download_links|binary]] works great for 32-bit Release build of Slicer. See [[#Download_links]]
+
* Using [[#Download_links|binary]] works great for 32-bit Release build of Slicer. See [[#Download_links]] and [[#Installation_instruction]]
  
 +
 +
<br><br><br><br>
  
 
= Download Qt: Source and Binaries =
 
= Download Qt: Source and Binaries =
Line 29: Line 32:
 
{{ambox
 
{{ambox
 
| type  = warning
 
| type  = warning
| text  = While it is not enforced, we strongly recommend you to '''USE''' the recommended version of Qt. We mean it.<br>
+
| text  = While it is not enforced, we strongly advise you to '''USE''' the recommended version of Qt. We mean it.<br>
 
}}
 
}}
 
<br>
 
<br>
* <font size="-1">That said, if you feel like experimenting, nothing prevent you from building against a difference version.</font>
+
<font size="-1">That said, if you feel like experimenting, nothing prevent you from building against a difference version.</font>
  
  
Line 46: Line 49:
 
!colspan="4"|Windows
 
!colspan="4"|Windows
 
|- bgcolor="#FFFFCC"
 
|- bgcolor="#FFFFCC"
!colspan="1"|Tiger
+
!colspan="1"|<del>Tiger</del>
 
!colspan="1"|Leopard, SnowLeopard
 
!colspan="1"|Leopard, SnowLeopard
 
!colspan="2"|VS2008
 
!colspan="2"|VS2008
Line 53: Line 56:
 
!|32bits
 
!|32bits
 
!|64bits
 
!|64bits
!|32bits
+
!|<del>32bits</del>
 
!|64bits
 
!|64bits
 
!|32bits
 
!|32bits
Line 62: Line 65:
 
! bgcolor="#FFFFCC" | [http://get.qt.nokia.com/qt/source/ Qt source link]
 
! bgcolor="#FFFFCC" | [http://get.qt.nokia.com/qt/source/ Qt source link]
 
|align="center" colspan="2"| [http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz 4.7.4]  
 
|align="center" colspan="2"| [http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz 4.7.4]  
|align="center" colspan="1"| [http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz 4.7.4]
+
|style="background-color:#C0C0C0;" align="center" colspan="1"| <del>[http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz 4.7.4]</del>
 
|align="center" colspan="1"| [http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz 4.7.4]
 
|align="center" colspan="1"| [http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.tar.gz 4.7.4]
 
|align="center" colspan="2"| [http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.zip 4.7.4]
 
|align="center" colspan="2"| [http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.4.zip 4.7.4]
Line 70: Line 73:
 
|align="center" colspan="1"| [http://sw.nokia.com/id/8ea74da4-fec1-4277-8b26-c58cc82e204b/Qt_SDK_Lin32_offline SDK-1.2]
 
|align="center" colspan="1"| [http://sw.nokia.com/id/8ea74da4-fec1-4277-8b26-c58cc82e204b/Qt_SDK_Lin32_offline SDK-1.2]
 
|align="center" colspan="1"| [http://sw.nokia.com/id/14b2039c-0e1f-4774-a4f2-9aa60b6d5313/Qt_SDK_Lin64_offline SDK-1.2]
 
|align="center" colspan="1"| [http://sw.nokia.com/id/14b2039c-0e1f-4774-a4f2-9aa60b6d5313/Qt_SDK_Lin64_offline SDK-1.2]
|align="center" colspan="1"| [http://get.qt.nokia.com/qt/source/qt-mac-carbon-opensource-4.7.0.dmg carbon_4.7.0]
+
|style="background-color:#C0C0C0;" align="center" colspan="1"| <del>[http://get.qt.nokia.com/qt/source/qt-mac-carbon-opensource-4.7.0.dmg carbon_4.7.0]</del>
 
|align="center" colspan="1"| [ftp://ftp.qt.nokia.com/qt/source/qt-mac-opensource-4.7.4-debug-libs.dmg cocoa_4.7.4]  
 
|align="center" colspan="1"| [ftp://ftp.qt.nokia.com/qt/source/qt-mac-opensource-4.7.4-debug-libs.dmg cocoa_4.7.4]  
 
|align="center" colspan="1"| [http://get.qt.nokia.com/qt/source/qt-win-opensource-4.7.4-vs2008.exe 4.7.4]
 
|align="center" colspan="1"| [http://get.qt.nokia.com/qt/source/qt-win-opensource-4.7.4-vs2008.exe 4.7.4]
Line 77: Line 80:
 
|align="center" colspan="1"| -
 
|align="center" colspan="1"| -
 
|}
 
|}
 +
 +
 +
== Installation instruction ==
 +
 +
=== Linux ===
 +
 +
See [[Documentation/{{documentation/version}}/Developers/Build_Instructions/Prerequisites/Qt/Instal_QtSDK1.2_Offline_Linux_64|Qt installation guide (4.7.4, Linux, 64-bit, Offline)]]
 +
 +
=== Mac ===
 +
 +
TBD
 +
 +
=== Windows ===
 +
 +
TBD
  
 
== Qt version specific issues ==
 
== Qt version specific issues ==
  
Qt 4.6 on mac: hard to compile (tbd: be more specific)
+
=== All ===
  
Qt 4.6.x on windows (and possibly in linux/mac): No image base64 support in QLabel/QTooltips (work around exists though)
+
* '''Qt 4.6.x''' on windows (and possibly in linux/mac): No image base64 support in QLabel/QTooltips (work around exists though)
+
* '''Qt 4.8''' does not work with PythonQt in slicer4 - suggested version is 4.7.4
Qt 4.7 on mac: click outside of popup (http://na-mic.org/Mantis/view.php?id=1241) Fixed in Qt 4.8 ?
 
  
Qt 4.7.3 in mac: http://na-mic.org/Mantis/view.php?id=1388 (fixed in Qt 4.7.4)
+
=== Linux ===
  
Qt 4.8 does not work with PythonQt in slicer4 - suggested version is 4.7.4
+
* NA
  
 +
=== Mac ===
  
 +
* '''Qt 4.6''': hard to compile - TBD: Be more specific
 +
* '''Qt 4.7''': click outside of popup (http://na-mic.org/Mantis/view.php?id=1241) - Is it fixed in Qt 4.8 ?
 +
* '''Qt 4.7.3''': http://na-mic.org/Mantis/view.php?id=1388 - Fixed in Qt 4.7.4
 +
 +
=== Windows ===
 +
 +
* NA
  
 
== How to change the minimum required version ? ==
 
== How to change the minimum required version ? ==
Line 96: Line 121:
 
* It's indeed possible to use a different version, just be aware that moving forward in time, things may not work as expected. Even worse Slicer may simply fail to compile.
 
* It's indeed possible to use a different version, just be aware that moving forward in time, things may not work as expected. Even worse Slicer may simply fail to compile.
  
* By configuring Slicer using <code>-DSlicer_REQUIRED_QT_VERSION:STRING=4.7.0</code>, you will be able to change the minimum required version.
+
* By configuring Slicer using <code>-DSlicer_REQUIRED_QT_VERSION:STRING=4.7.0</code>, you will be able to change the required version.
  
 
* See [https://github.com/Slicer/Slicer/commit/898bb14e 898bb14e], [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=19698 r19698], [http://massmail.spl.harvard.edu/public-archives/slicer-devel/2012/008130.html Mailing list]
 
* See [https://github.com/Slicer/Slicer/commit/898bb14e 898bb14e], [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=19698 r19698], [http://massmail.spl.harvard.edu/public-archives/slicer-devel/2012/008130.html Mailing list]
 +
 +
 +
<br><br><br><br>
  
 
= Build instructions =
 
= Build instructions =
Line 108: Line 136:
  
 
== Linux ==
 
== Linux ==
 +
<!--
 +
TODO: Add a section specific to debian based platform.
 
*Downloading the binaries of Qt works fine with Linux, you do not have to compile Qt manually.  
 
*Downloading the binaries of Qt works fine with Linux, you do not have to compile Qt manually.  
 
** Note: You need to install the libQtWebkit-devel package too.
 
** Note: You need to install the libQtWebkit-devel package too.
*The following descriptions are given for people who want to compile Qt anyway.
+
-->
** Consider installing the following optional packages (<code>libxt-dev libxrender-dev libxrandr-dev libxinerama-dev libxcursor-dev libfontconfig-dev libglib2.0-dev</code>)
+
 
 +
* Your Qt must be OpenGL enabled. On debian, install: <code>libgl1-mesa-glx libglu1-mesa-glx</code>
 +
* Consider installing the following optional packages (<code>libxt-dev libxrender-dev libxrandr-dev libxinerama-dev libxcursor-dev libfontconfig-dev libglib2.0-dev</code>)
 +
 
 
<pre>
 
<pre>
mkdir Qt
+
mkdir qt-everywhere-opensource-build-4.7.4
mkdir Qt-build
+
tar xvfz qt-everywhere-opensource-src-4.7.4.tar.gz
cd Qt
+
cd qt-everywhere-opensource-src-4.7.4
wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.3.tar.gz
+
./configure -prefix ../qt-everywhere-opensource-build-4.7.4 -debug-and-release -opensource -confirm-license -no-qt3support -webkit -nomake examples -nomake demos
tar xvfz qt-everywhere-opensource-src-4.6.3.tar.gz
 
cd qt-everywhere-opensource-src-4.6.3
 
echo yes | ./configure -prefix ../../Qt-build -debug-and-release -opensource -no-qt3support -webkit
 
 
make -j8
 
make -j8
 
make install
 
make install
 
</pre>
 
</pre>
Note: On a 64 bit system, you may have to add <code>-arch x86_64</code> to the Qt configure command line (?)
+
<!-- Note: On a 64 bit system, you may have to add <code>-arch x86_64</code> to the Qt configure command line (?) -->
 
Note: Adapt <code>-j8</code> with the number of core on your machine, a dual core should probably not do more than <code>-j3</code>, an 8 core machine can resonably go as much as <code>-j12</code>.
 
Note: Adapt <code>-j8</code> with the number of core on your machine, a dual core should probably not do more than <code>-j3</code>, an 8 core machine can resonably go as much as <code>-j12</code>.
  
 +
== Mac  ==
 +
 +
Similar to Linux configuration. Note that <code>-arch x86_64</code> has been added.
  
== Mac ==
+
For earlier versions of Xcode and Mac OS X
Same as Linux. Use the flag <code>-cocoa</code> on the configure command-line(the <code>-shared</code> flag should be set automatically); for a 64 bit build on SnowLeopard use <code>-arch x86_64</code>. For more information go to http://doc.qt.nokia.com/4.6/developing-on-mac.html (warning default values are different: <code>-carbon</code> vs <code>-cocoa</code> for Qt 4.7: http://doc.qt.nokia.com/4.7/developing-on-mac.html)
+
<pre>
 +
mkdir qt-everywhere-opensource-build-4.7.4
 +
tar xvfz qt-everywhere-opensource-src-4.7.4.tar.gz
 +
cd qt-everywhere-opensource-src-4.7.4
 +
./configure -prefix ../qt-everywhere-opensource-build-4.7.4 -debug-and-release -opensource -confirm-license -no-qt3support -webkit -arch x86_64 -nomake examples -nomake demos -sdk /Developer/SDKs/MacOSX10.5.sdk/
 +
make -j8
 +
make install
 +
</pre>
 +
 
 +
On the latest Xcode versions (4.3) and Lion (10.7) the Developer directories have movedThe command is now:
 +
 
 +
<pre>
 +
./configure -prefix ../qt-everywhere-opensource-build-4.7.4 -debug-and-release -opensource -confirm-license -no-qt3support -arch x86_64 -nomake examples -nomake demos -webkit -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
 +
</pre>
 +
 
 +
* Consider reading: http://doc.qt.nokia.com/4.7/developing-on-mac.html)
  
 +
* Note:
 +
** If building against SDK 10.6 or 10.7, you will probably get link errors similar to what's described in [https://trac.macports.org/ticket/30346] and [http://qt-project.org/forums/viewthread/15933]. The solution is probably to disable the <code>corewlan</code> module but didn't figure out to do that properly.
  
 
== Windows ==
 
== Windows ==
  
*# Use a windows extracter to unzip the [#Prerequisites|Qt zip archive], don't use cygwin unzip it.
+
# Use a windows extracter to unzip the [[Documentation/{{documentation/version}}/Developers/Build_Instructions/Prerequisites/Qt#Download_links|Qt archive]], don't use cygwin unzip it.
*# launch the msvc2008 command prompt (MSVC08->Tools->Visual Studio 2008 CommandPrompt) (or: launch cmd.exe and run <code>vcvars32.bat</code>) Note: Start x64 prompt from Start menu (don't start from inside visual studio or it will be an x86 32 bit shell).  Menu item is "Visual Studio 2008 x64 Win64 Command Prompt"
+
# launch the msvc2008 command prompt (MSVC08->Tools->Visual Studio 2008 CommandPrompt) (or: launch cmd.exe and run <code>vcvars32.bat</code>) Note: Start x64 prompt from Start menu (don't start from inside visual studio or it will be an x86 32 bit shell).  Menu item is "Visual Studio 2008 x64 Win64 Command Prompt"
*# build with <code>configure.exe -platform win32-msvc2008 -debug</code>  
+
# build with <code>configure.exe -platform win32-msvc2008 -debug -nomake examples -nomake demos</code>  
*#* When asked, choose open source license type (o), then accept the license (y)
+
#* When asked, choose open source license type (o), then accept the license (y)
*#* Note: the option <code>-prefix</code> doesn't work on Windows.
+
#* Note: the configure options are exactly the same for 32-bit and 64-bit builds (the platform is always win32-msvc2008)
*#* Note: According to [http://qt.nokia.com/doc/4.7/supported-platforms.html] Qt does not support msvc2008 on windows xp.  However, running <code>configure.exe</code> with no <code>-platform</code> argument seems to work. If you run configure with the <code>-platform</code> argument first by mistake, and if <code>configure -clean</code> doesn't work, then you may need to start from a fresh extraction from the .zip archive before running <code>configure.exe</code> again with no <code>-platform</code>, unless you can run <code>nmake</code> with the config clean target.
+
#* Note: the option <code>-prefix</code> doesn't work on Windows.
*#* Note: for Microsoft Visual Studio 2010 users, Qt 4.6.3 is hard to configure with MSVC2010, use Qt 4.7.x instead. Build with <code>set QMAKESPEC=win32-msvc2010</code> and <code>configure -platform win32-msvc2010  -debug</code>
+
#* Note: According to [http://qt.nokia.com/doc/4.7/supported-platforms.html] Qt does not support msvc2008 on windows xp.  However, running <code>configure.exe</code> with no <code>-platform</code> argument seems to work. If you run configure with the <code>-platform</code> argument first by mistake, and if <code>configure -clean</code> doesn't work, then you may need to start from a fresh extraction from the .zip archive before running <code>configure.exe</code> again with no <code>-platform</code>, unless you can run <code>nmake</code> with the config clean target.
*# run <code>nmake</code>
+
#* Note: for Microsoft Visual Studio 2010 users, Qt 4.6.3 is hard to configure with MSVC2010, use Qt 4.7.x instead. Build with <code>set QMAKESPEC=win32-msvc2010</code> and <code>configure -platform win32-msvc2010  -debug</code>
*#* Note: building with webkit support requires that <i>src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared/mocinclude.tmp</i> be removed. else you will get linker errors like <code>QNetworkReplyHandler.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall WebCore::FormDataIODevice::metaObject(void)const (?metaObject@FormDataIODevice@WebCore@@UBEPBUQMetaObject@@XZ)</code>
+
# run <code>nmake</code>
*#* Note: If you encounter the following error <code>api\qscriptextensionplugin.h(43): Error: Undefined interface,</code>, delete the files <i>\src\script\tmp\moc\debug_shared\mocinclude.tmp</i> and <i>\src\script\tmp\moc\release_shared\mocinclude.tmp</i> and restart nmake. For more info, please see [http://bugreports.qt.nokia.com/browse/QTBUG-6470 QTBug 6470]].
+
#* Note: building with webkit support requires that <i>src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared/mocinclude.tmp</i> be removed. else you will get linker errors like <code>QNetworkReplyHandler.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall WebCore::FormDataIODevice::metaObject(void)const (?metaObject@FormDataIODevice@WebCore@@UBEPBUQMetaObject@@XZ)</code>
 +
#* Note: If you encounter the following error <code>api\qscriptextensionplugin.h(43): Error: Undefined interface,</code>, delete the files <i>\src\script\tmp\moc\debug_shared\mocinclude.tmp</i> and <i>\src\script\tmp\moc\release_shared\mocinclude.tmp</i> and restart nmake. For more info, please see [http://bugreports.qt.nokia.com/browse/QTBUG-6470 QTBug 6470]].
 +
 
 +
Special instructions for compiling Qt 4.7.4 with Visual Studio 2010 (not yet supported officially):
 +
* Visual Studio 2010 should be installed, as well as [http://www.microsoft.com/download/en/details.aspx?id=23691 SP1]  and [https://www.microsoft.com/download/en/details.aspx?id=4422 compiler update].
 +
* To compile Qt 4.7.4 using VS2010 Express or Professional, see [http://thomasstockx.blogspot.com/2011/03/qt-472-in-visual-studio-2010.html this tutorial] (Skip step 3 if using Express version).
 +
* At step 11 of the tutorial, replace option -no-webkit by -webkit (required to build Slicer).

Latest revision as of 07:30, 14 June 2013

Home < Documentation < 4.0 < Developers < Build Instructions < Prerequisites < Qt


For the latest Slicer documentation, visit the read-the-docs.


Binary vs build-from-source ?

If you build Slicer on ...

Linux

Mac

Windows

Debug (32 and 64-bit) or Release (64-bit)

  • Details: Using the Qt Designer on Windows requires that the Slicer plugins are in the same mode as Qt. If Qt was compiled in Release mode (default), Slicer would have to be compiled in Release mode as well. However if Qt is compiled in Debug mode only, Slicer has to be compiled in Debug too. When Qt is in "Release and Debug" mode only the Release version of Designer.exe is generated, Slicer would have to be compiled in Release. So for developers, the Debug mode is recommended, this is why we detail the compilation of Qt below.

Release (32-bit)






Download Qt: Source and Binaries



That said, if you feel like experimenting, nothing prevent you from building against a difference version.


Download links

The following table list the link allowing to download either the recommended source code or binary of Qt.

Linux Mac Windows
Tiger Leopard, SnowLeopard VS2008 VS2010
32bits 64bits 32bits 64bits 32bits 64bits 32bits 64bits
Qt source link 4.7.4 4.7.4 4.7.4 4.7.4 4.7.4
Qt binary link SDK-1.2 SDK-1.2 carbon_4.7.0 cocoa_4.7.4 4.7.4 - 4.7.4 -


Installation instruction

Linux

See Qt installation guide (4.7.4, Linux, 64-bit, Offline)

Mac

TBD

Windows

TBD

Qt version specific issues

All

  • Qt 4.6.x on windows (and possibly in linux/mac): No image base64 support in QLabel/QTooltips (work around exists though)
  • Qt 4.8 does not work with PythonQt in slicer4 - suggested version is 4.7.4

Linux

  • NA

Mac

Windows

  • NA

How to change the minimum required version ?

  • It's indeed possible to use a different version, just be aware that moving forward in time, things may not work as expected. Even worse Slicer may simply fail to compile.
  • By configuring Slicer using -DSlicer_REQUIRED_QT_VERSION:STRING=4.7.0, you will be able to change the required version.






Build instructions



Linux

  • Your Qt must be OpenGL enabled. On debian, install: libgl1-mesa-glx libglu1-mesa-glx
  • Consider installing the following optional packages (libxt-dev libxrender-dev libxrandr-dev libxinerama-dev libxcursor-dev libfontconfig-dev libglib2.0-dev)
mkdir qt-everywhere-opensource-build-4.7.4
tar xvfz qt-everywhere-opensource-src-4.7.4.tar.gz
cd qt-everywhere-opensource-src-4.7.4
./configure -prefix ../qt-everywhere-opensource-build-4.7.4 -debug-and-release -opensource -confirm-license -no-qt3support -webkit -nomake examples -nomake demos
make -j8
make install

Note: Adapt -j8 with the number of core on your machine, a dual core should probably not do more than -j3, an 8 core machine can resonably go as much as -j12.

Mac

Similar to Linux configuration. Note that -arch x86_64 has been added.

For earlier versions of Xcode and Mac OS X

mkdir qt-everywhere-opensource-build-4.7.4
tar xvfz qt-everywhere-opensource-src-4.7.4.tar.gz
cd qt-everywhere-opensource-src-4.7.4
./configure -prefix ../qt-everywhere-opensource-build-4.7.4 -debug-and-release -opensource -confirm-license -no-qt3support -webkit -arch x86_64 -nomake examples -nomake demos -sdk /Developer/SDKs/MacOSX10.5.sdk/
make -j8
make install

On the latest Xcode versions (4.3) and Lion (10.7) the Developer directories have moved. The command is now:

./configure -prefix ../qt-everywhere-opensource-build-4.7.4 -debug-and-release -opensource -confirm-license -no-qt3support -arch x86_64 -nomake examples -nomake demos -webkit -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
  • Note:
    • If building against SDK 10.6 or 10.7, you will probably get link errors similar to what's described in [1] and [2]. The solution is probably to disable the corewlan module but didn't figure out to do that properly.

Windows

  1. Use a windows extracter to unzip the Qt archive, don't use cygwin unzip it.
  2. launch the msvc2008 command prompt (MSVC08->Tools->Visual Studio 2008 CommandPrompt) (or: launch cmd.exe and run vcvars32.bat) Note: Start x64 prompt from Start menu (don't start from inside visual studio or it will be an x86 32 bit shell). Menu item is "Visual Studio 2008 x64 Win64 Command Prompt"
  3. build with configure.exe -platform win32-msvc2008 -debug -nomake examples -nomake demos
    • When asked, choose open source license type (o), then accept the license (y)
    • Note: the configure options are exactly the same for 32-bit and 64-bit builds (the platform is always win32-msvc2008)
    • Note: the option -prefix doesn't work on Windows.
    • Note: According to [3] Qt does not support msvc2008 on windows xp. However, running configure.exe with no -platform argument seems to work. If you run configure with the -platform argument first by mistake, and if configure -clean doesn't work, then you may need to start from a fresh extraction from the .zip archive before running configure.exe again with no -platform, unless you can run nmake with the config clean target.
    • Note: for Microsoft Visual Studio 2010 users, Qt 4.6.3 is hard to configure with MSVC2010, use Qt 4.7.x instead. Build with set QMAKESPEC=win32-msvc2010 and configure -platform win32-msvc2010 -debug
  4. run nmake
    • Note: building with webkit support requires that src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared/mocinclude.tmp be removed. else you will get linker errors like QNetworkReplyHandler.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall WebCore::FormDataIODevice::metaObject(void)const (?metaObject@FormDataIODevice@WebCore@@UBEPBUQMetaObject@@XZ)
    • Note: If you encounter the following error api\qscriptextensionplugin.h(43): Error: Undefined interface,, delete the files \src\script\tmp\moc\debug_shared\mocinclude.tmp and \src\script\tmp\moc\release_shared\mocinclude.tmp and restart nmake. For more info, please see QTBug 6470].

Special instructions for compiling Qt 4.7.4 with Visual Studio 2010 (not yet supported officially):

  • Visual Studio 2010 should be installed, as well as SP1 and compiler update.
  • To compile Qt 4.7.4 using VS2010 Express or Professional, see this tutorial (Skip step 3 if using Express version).
  • At step 11 of the tutorial, replace option -no-webkit by -webkit (required to build Slicer).