Documentation/Nightly/Developers/Build Instructions/Prerequisites/Qt
From Slicer Wiki
Home < Documentation < Nightly < 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
- Using binary works great for both Debug and Release build of Slicer. See #Download_links and #Installation_instruction
Mac
- Using binary works great for both Debug and Release build of Slicer. See #Download_links and #Installation_instruction
- To use QtCreator and the Slicer designer plugins, a possible option is to build QtCreator against the installed Qt libraries. See discussion on the mailing list.
Windows
Debug (32 and 64-bit) or Release (64-bit)
- Normally you should plan to build Qt from source to have complete control over the process. See one-liner build command or more detailed #Build_instructions
- You may find that the unsigned binary downloads from this site are usable: http://sourceforge.net/projects/qtx64/files/qt-x64/4.8.5/msvc2008/
- 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)
- Using binary works great for 32-bit Release build of Slicer. See #Download_links and #Installation_instruction
Download Qt: Source and Binaries
Download links
The following table list the link allowing to download either the recommended source code or binary of Qt.
Linux | Mac | Windows | |||
---|---|---|---|---|---|
SnowLeopard | Lion, Mountain Lion | VS2008 | VS2010 | ||
64bits | 64bits | 64bits | 64bits | 64bits | |
Qt source link | 4.8.6 | 4.7.4 | 4.8.6 | 4.8.6 | 4.8.6 |
Qt binary link | (src or apt-get package) | 4.7.4 4.7.4 (optional: debug libs) |
4.8.6 4.8.6 (optional: debug libs) |
4.8.6 (unsigned installer) | 4.8.6 (unsigned installer) |
Qt version specific issues
- Issues for Qt < 4.7.4 are not reported
All
- NA
Linux
- NA
Mac
- Problem building Qt on MacOSX 10.9. See https://bugreports.qt-project.org/browse/QTBUG-32237
Windows
- NA
How to change the minimum required version ?
- This applied only for Slicer < r22466.
- 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 minimum required version.
- See 898bb14e, r19698, Mailing list
Build instructions
![]() |
Please, make sure that your IDE/compiler is properly installed and that all associated ServicePack are also installed. See Prerequisites. |
Linux
See Documentation/Nightly/Developers/Build_Instructions#Linux
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
- Consider reading: http://doc.qt.nokia.com/4.7/developing-on-mac.html)
- Note:
Windows
- Use a windows extracter to unzip the Qt archive, don't use cygwin unzip it.
Qt 4.7.4 / VS2008
- Rename the folder into for example
qt-4.7.4-64-vs2008-rel
.- Note: Each build of Qt should be done it its own folder !
- Note: A 32 bit debug build would be done in a folder named
qt-4.7.4-32-vs2008-deb
- Launch the msvc2008 command prompt
- 32-bit build: Start menu -> MSVC08->Tools -> "Visual Studio 2008 Command Prompt"
- 64-bit build: Start menu -> MSVC08->Tools -> "Visual Studio 2008 x64 Win64 Command Prompt"
- Configure
- For debug:
configure.exe -platform win32-msvc2008 -opensource -confirm-license -debug -webkit -nomake examples -nomake demos
- For release:
configure.exe -platform win32-msvc2008 -opensource -confirm-license -release -webkit -nomake examples -nomake demos
- Note:
win32-msvc2008
is used for both 32 and 64-bit. - 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 ifconfigure -clean
doesn't work, then you may need to start from a fresh extraction from the .zip archive before runningconfigure.exe
again with no-platform
, unless you can runnmake
with the config clean target.
- For debug:
- Build using
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].
- 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
Qt 4.8.5 / VS2010
- Rename the folder into for example
qt-4.8.5-64-vs2010-rel
.- Note: Each build of Qt should be done it its own folder !
- Note: A 32 bit debug build would be done in a folder named
qt-4.8.5-32-vs2010-deb
- Launch the msvc2010 command prompt
- 32-bit build: Start menu -> MSVC10->Tools -> "Visual Studio 2010 Command Prompt"
- 64-bit build: Start menu -> MSVC10->Tools -> "Visual Studio 2010 x64 Win64 Command Prompt"
- Download pearl http://strawberryperl.com/ and create a new folder into for example
strawberry
.
- Download jom and create a new folder into for example
jom
.- Add this new folder into the path (system properties)
- Configure
- For debug:
configure.exe -platform win32-msvc2010 -debug -opensource -confirm-license -webkit -nomake examples -nomake demos
- For release:
configure.exe -platform win32-msvc2010 -release -opensource -confirm-license -webkit -nomake examples -nomake demos
- Note:
win32-msvc2010
is used for both 32 and 64-bit. - Note: The option
-prefix
doesn't work on Windows.
- For debug:
- Build using
jom -jn
- Note: n is the number of cores of your CPU, so adapt it.
- 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 jom. For more info, please see QTBug 6470].
Qt 4.8.6 / VS2012
- Make sure your Visual Studio 2012 is patched with the latest patch (e.g. patch 4).
- Download the source archive, extract and rename the folder into for example
qt-4.8.6-64-vs2012-rel
.- Note: Each build of Qt should be done it its own folder !
- Note: A 32 bit debug build would be done in a folder named
qt-4.8.6-32-vs2010-deb
- Replace the webkit src\3rdparty\webkit\Source\JavaScriptCore\wtf\hashset.h file with this file
- For VS2013, replace the MathExtras.h file [4]
- For VS2015, use the 4.8.7 source [5] and apply the patch [6]
- Launch the msvc2012 command prompt
- 32-bit build: Start menu -> MSVC12->Visual Studio Tools -> "VS2012 x86 Command Prompt"
- 64-bit build: Start menu -> MSVC12->Visual Studio Tools -> "VS2012 x64 Win64 Command Prompt"
- If you want openssl support (optional):
- Download perl http://strawberryperl.com/ and create a new folder into for example
strawberry
.
- Download perl http://strawberryperl.com/ and create a new folder into for example
- Configure
- For debug:
configure.exe -platform win32-msvc2012 -debug -opensource -confirm-license -webkit -nomake examples -nomake demos
- For release:
configure.exe -platform win32-msvc2012 -release -opensource -confirm-license -webkit -nomake examples -nomake demos
- Note:
win32-msvc2012
is used for both 32 and 64-bit. - Note: The option
-prefix
doesn't work on Windows.
- For debug:
- Build using
nmake
- Alternatively you can use jom (much faster)
- Download jom and create a new folder into for example
jom
. - Add this new folder into the path (system properties)
- Build using
jom -jn
- Note: n is the number of cores of your CPU, so adapt it.
- Download jom and create a new folder into for example
- Alternatively you can use jom (much faster)