Difference between revisions of "Documentation/Nightly/Developers/Build Instructions/Prerequisites/Qt"
m (→Download links) |
(→Mac) |
||
(62 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
+ | <noinclude>{{documentation/versioncheck}}</noinclude> | ||
= Binary vs build-from-source ? = | = Binary vs build-from-source ? = | ||
Line 13: | Line 14: | ||
* To use QtCreator and the Slicer designer plugins, a possible option is to build QtCreator against the installed Qt libraries. See [http://slicer-devel.65872.n3.nabble.com/Using-Qt-Creator-with-Slicer4-On-Mac-OS-X-Multiple-Qt-libs-loaded-tp4026660p4026690.html discussion on the mailing list]. | * To use QtCreator and the Slicer designer plugins, a possible option is to build QtCreator against the installed Qt libraries. See [http://slicer-devel.65872.n3.nabble.com/Using-Qt-Creator-with-Slicer4-On-Mac-OS-X-Multiple-Qt-libs-loaded-tp4026660p4026690.html discussion on the mailing list]. | ||
− | == | + | === Mac with Homebrew === |
− | + | As an alternative to the binary, you can install QT 4.8.7 with homebrew on mac 10.12: | |
− | + | <pre> | |
− | + | brew tap cartr/qt4 | |
− | + | brew tap-pin cartr/qt4 | |
− | + | brew install qt@4 | |
− | + | brew install qt-webkit@2.3 | |
− | + | </pre> | |
− | |||
− | |||
+ | == Windows == | ||
+ | * Normally you should plan to build Qt from source to have complete control over the process. See [https://github.com/jcfr/qt-easy-build one-liner build command] or more detailed [[#Build_instructions]]. | ||
+ | ** You may find that the binary downloads are usable for older Visual Studio versions (but not for the currently official Visual Studio 2013 version): [[#Download_links|binary]]. If you use .7z varaints extract them in the default location C:\Qt\ otherwise that installation will not be properly configured for use with CMake. | ||
+ | * Debug/release mode builds: The recommendation for developers is to build Slicer and Qt at least in Debug mode. To be able to test real-world performance, developers should also build Qt and Slicer in release mode (in a separate build tree), because some algorithms are 10x or more faster in release mode. | ||
+ | ** Rationale: 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 to be able to use the Qt Designer. | ||
+ | * 32/64-bit builds: When using 32-bit builds, the available memory space is so limited that the application would run out of memory and crash even working with average-sized data sets. Therefore 64-bit build is recommended for general use. 32-bit applications should only be used when running 3D Slicer on 32-bit operating system (such as a tablet with 32-bit Windows), working with limited-size problems (simple surfaces, image slices, low-resolution image volumes). | ||
<br><br><br><br> | <br><br><br><br> | ||
Line 37: | Line 42: | ||
|- bgcolor="#FFFFCC" | |- bgcolor="#FFFFCC" | ||
!rowspan="3"| | !rowspan="3"| | ||
− | !colspan=" | + | !colspan="1" rowspan="2"|Linux |
!colspan="2"|Mac | !colspan="2"|Mac | ||
− | !colspan=" | + | !colspan="3"|Windows |
|- bgcolor="#FFFFCC" | |- bgcolor="#FFFFCC" | ||
− | !colspan="1"| | + | !colspan="1"|SnowLeopard |
− | !colspan="1"| | + | !colspan="1"|Lion, Mountain Lion |
− | !colspan=" | + | !colspan="1"|VS2008 |
− | !colspan=" | + | !colspan="1"|VS2010 |
+ | !colspan="1"|VS2013 | ||
|- bgcolor="#FFFFCC" | |- bgcolor="#FFFFCC" | ||
− | |||
!|64bits | !|64bits | ||
− | |||
!|64bits | !|64bits | ||
− | |||
!|64bits | !|64bits | ||
− | !| | + | !|64bits |
+ | !|64bits | ||
!|64bits | !|64bits | ||
|- | |- | ||
− | ! bgcolor="#FFFFCC" | [http:// | + | ! bgcolor="#FFFFCC" | Qt source link |
− | |align="center" colspan=" | + | |align="center" colspan="1"| [http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz 4.8.6] |
− | | | + | |align="center" colspan="1"| [http://download.qt-project.org/archive/qt/4.7/qt-everywhere-opensource-src-4.7.4.tar.gz 4.7.4] |
− | |align="center" colspan="1"| [ | + | |align="center" colspan="1"| [http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.tar.gz 4.8.6] |
− | |align="center" colspan=" | + | |align="center" colspan="1"| [http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.zip 4.8.6] |
− | |align="center" colspan=" | + | |align="center" colspan="1"| [http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.zip 4.8.6] |
+ | |align="center" colspan="1"| [http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.zip 4.8.7] | ||
|- | |- | ||
− | ! bgcolor="#FFFFCC" | | + | ! bgcolor="#FFFFCC" | Qt binary link |
− | |align="center" colspan="1"| [http:// | + | |align="center" colspan="1"| (src or apt-get package) <!-- [http://packages.kitware.com/download/item/3733/QtSdk-offline-linux-x86_64-v1.2.1.run SDK-1.2] --> |
− | |align="center" colspan="1"| [http:// | + | |align="center" colspan="1"| [http://packages.kitware.com/download/item/3736/qt-mac-opensource-4.7.4.dmg 4.7.4] <br> [http://packages.kitware.com/download/item/3739/qt-mac-opensource-4.7.4-debug-libs.dmg 4.7.4 (optional: debug libs)] |
− | + | |align="center" colspan="1"| [http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-opensource-mac-4.8.6-1.dmg 4.8.6] <br> [http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-opensource-mac-4.8.6-1-debug-libs.dmg 4.8.6 (optional: debug libs)] | |
− | |align="center" colspan="1"| [ | ||
− | |align="center" colspan="1"| [ | + | |align="center" colspan="1"| [http://sourceforge.net/projects/qt64ng/files/qt/x86-64/4.8.6/msvc2008/qt-4.8.6-x64-msvc2008.exe/download 4.8.6 (unsigned installer)] |
− | + | |align="center" colspan="1"| [http://sourceforge.net/projects/qt64ng/files/qt/x86-64/4.8.6/msvc2010/qt-4.8.6-x64-msvc2010.exe/download 4.8.6 (unsigned installer)] | |
− | |align="center" colspan="1"| [ | ||
− | |||
|} | |} | ||
+ | <!-- | ||
== Installation instruction == | == Installation instruction == | ||
Line 87: | Line 90: | ||
TBD | TBD | ||
+ | --> | ||
== Qt version specific issues == | == Qt version specific issues == | ||
+ | |||
+ | * Issues for Qt < 4.7.4 are not reported | ||
=== All === | === All === | ||
− | + | * NA | |
+ | <!-- | ||
* '''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.8''' does not work with PythonQt in slicer4 - suggested version is 4.7.4 | ||
− | + | --> | |
=== Linux === | === Linux === | ||
Line 100: | Line 107: | ||
=== Mac === | === Mac === | ||
− | + | * Problem building Qt on MacOSX 10.9. See https://bugreports.qt.io/browse/QTBUG-32237. Patch: https://gist.github.com/ejtttje/7163a9ced64f12ae9444. | |
+ | <!-- | ||
* '''Qt 4.6''': hard to compile - TBD: Be more specific | * '''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''': 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 | * '''Qt 4.7.3''': http://na-mic.org/Mantis/view.php?id=1388 - Fixed in Qt 4.7.4 | ||
+ | --> | ||
=== Windows === | === Windows === | ||
Line 110: | Line 119: | ||
== How to change the minimum required version ? == | == How to change the minimum required version ? == | ||
+ | |||
+ | * This applied only for Slicer < [http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=22466 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. | * 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. | ||
Line 128: | Line 139: | ||
== Linux == | == Linux == | ||
+ | |||
+ | See [[Documentation/Nightly/Developers/Build_Instructions#Linux]] | ||
<!-- | <!-- | ||
TODO: Add a section specific to debian based platform. | TODO: Add a section specific to debian based platform. | ||
Line 134: | Line 147: | ||
--> | --> | ||
+ | <!-- | ||
* Consider installing the following optional packages (<code>libxt-dev libxrender-dev libxrandr-dev libxinerama-dev libxcursor-dev libfontconfig-dev libglib2.0-dev</code>) | * Consider installing the following optional packages (<code>libxt-dev libxrender-dev libxrandr-dev libxinerama-dev libxcursor-dev libfontconfig-dev libglib2.0-dev</code>) | ||
− | + | {{pre2|scroll| | |
mkdir qt-everywhere-opensource-build-4.7.4 | mkdir qt-everywhere-opensource-build-4.7.4 | ||
tar xvfz qt-everywhere-opensource-src-4.7.4.tar.gz | tar xvfz qt-everywhere-opensource-src-4.7.4.tar.gz | ||
cd qt-everywhere-opensource-src-4.7.4 | cd qt-everywhere-opensource-src-4.7.4 | ||
− | ./configure -prefix ../qt-everywhere-opensource-build-4.7.4 -debug | + | ./configure -prefix ../qt-everywhere-opensource-build-4.7.4 -debug -opensource -confirm-license -no-qt3support -webkit -nomake examples -nomake demos |
make -j8 | make -j8 | ||
make install | make install | ||
− | + | }} | |
+ | --> | ||
<!-- 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 == | == Mac == | ||
Line 152: | Line 169: | ||
For earlier versions of Xcode and Mac OS X | For earlier versions of Xcode and Mac OS X | ||
− | + | {{pre2|scroll| | |
mkdir qt-everywhere-opensource-build-4.7.4 | mkdir qt-everywhere-opensource-build-4.7.4 | ||
tar xvfz qt-everywhere-opensource-src-4.7.4.tar.gz | tar xvfz qt-everywhere-opensource-src-4.7.4.tar.gz | ||
cd qt-everywhere-opensource-src-4.7.4 | 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 | + | ./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 -j8 | ||
make install | make install | ||
− | + | }} | |
On the latest Xcode versions (4.3) and Lion (10.7) the Developer directories have moved. The command is now: | On the latest Xcode versions (4.3) and Lion (10.7) the Developer directories have moved. The command is now: | ||
− | + | {{pre2|scroll| | |
./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 | ./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) | * Consider reading: http://doc.qt.nokia.com/4.7/developing-on-mac.html) | ||
* Note: | * 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]. | + | ** 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]. Solution is provided here [https://bugreports.qt-project.org/browse/QTBUG-24361 here]. |
== Windows == | == Windows == | ||
+ | For current official version (using VS2013), use [https://github.com/jcfr/qt-easy-build one-liner build command]. | ||
+ | |||
+ | === Manual build instructions for older (not officially supported) configurations === | ||
+ | |||
+ | 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), and follow the instructions below. | ||
+ | |||
+ | ==== Qt 4.7.4 / VS2008 ==== | ||
+ | |||
+ | * Rename the folder into for example <code>qt-4.7.4-64-vs2008-rel</code>. | ||
+ | ** 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 <code>qt-4.7.4-32-vs2008-deb</code> | ||
+ | |||
+ | |||
+ | * Launch the msvc2008 command prompt <!-- (MSVC08->Tools->Visual Studio 2008 CommandPrompt) (or: launch cmd.exe and run <code>vcvars32.bat</code>) --> | ||
+ | ** 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" | ||
+ | <!-- | ||
+ | ** Note: Don't start prompt from inside visual studio or it will be an x86 32 bit shell. | ||
+ | --> | ||
+ | |||
+ | |||
+ | * Configure | ||
+ | ** For debug: <code>configure.exe -platform win32-msvc2008 -opensource -confirm-license -debug -webkit -nomake examples -nomake demos</code> | ||
+ | ** For release: <code>configure.exe -platform win32-msvc2008 -opensource -confirm-license -release -webkit -nomake examples -nomake demos</code> | ||
+ | ** Note: <code>win32-msvc2008</code> is used for both 32 and 64-bit. | ||
+ | ** Note: The option <code>-prefix</code> doesn't work on Windows. | ||
+ | ** 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. | ||
+ | |||
+ | |||
+ | * Build using <code>nmake</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> | ||
+ | ** 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]]. | ||
+ | |||
+ | ==== Qt 4.8.5 / VS2010 ==== | ||
+ | |||
+ | * Rename the folder into for example <code>qt-4.8.5-64-vs2010-rel</code>. | ||
+ | ** 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 <code>qt-4.8.5-32-vs2010-deb</code> | ||
+ | |||
+ | |||
+ | * Launch the msvc2010 command prompt <!-- (MSVC10->Tools->Visual Studio 2010 CommandPrompt) (or: launch cmd.exe and run <code>vcvars32.bat</code>) --> | ||
+ | ** 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" | ||
+ | <!-- | ||
+ | ** Note: Don't start prompt from inside visual studio or it will be an x86 32 bit shell. | ||
+ | --> | ||
+ | |||
+ | |||
+ | *Download pearl http://strawberryperl.com/ and create a new folder into for example <code>strawberry</code>. | ||
+ | |||
+ | |||
+ | *Download jom and create a new folder into for example <code>jom</code>. | ||
+ | **Add this new folder into the path (system properties) | ||
+ | |||
+ | |||
+ | * Configure | ||
+ | ** For debug: <code>configure.exe -platform win32-msvc2010 -debug -opensource -confirm-license -webkit -nomake examples -nomake demos</code> | ||
+ | ** For release: <code>configure.exe -platform win32-msvc2010 -release -opensource -confirm-license -webkit -nomake examples -nomake demos</code> | ||
+ | ** Note: <code>win32-msvc2010</code> is used for both 32 and 64-bit. | ||
+ | ** Note: The option <code>-prefix</code> doesn't work on Windows. | ||
+ | |||
+ | |||
+ | * Build using <code>jom -jn</code> | ||
+ | **Note: n is the number of cores of your CPU, so adapt it. | ||
+ | ** 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 jom. For more info, please see [http://bugreports.qt.nokia.com/browse/QTBUG-6470 QTBug 6470]]. | ||
+ | |||
+ | ==== Qt 4.8.6 / VS2012 ==== | ||
+ | |||
+ | * Make sure your Visual Studio 2012 is patched with the latest patch (e.g. [http://www.microsoft.com/en-us/download/confirmation.aspx?id=39305 patch 4]). | ||
+ | |||
+ | |||
+ | * Download the [http://download.qt-project.org/official_releases/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.zip source archive], extract and rename the folder into for example <code>qt-4.8.6-64-vs2012-rel</code>. | ||
+ | ** 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 <code>qt-4.8.6-32-vs2010-deb</code> | ||
+ | |||
+ | * Replace the webkit <i>src\3rdparty\webkit\Source\JavaScriptCore\wtf\hashset.h</i> file with this [https://bitbucket.org/Vertexwahn/bluego/src/56dbe84212222ec6954d8d327a5e443106bcc447/deploy/BlueGo0.0.4/qt4.8.3vs2012patch/HashSet.h?at=default file] | ||
+ | * For VS2013, replace the MathExtras.h file [http://code.qt.io/cgit/qt/qt.git/commit/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h?id=b05d05fd9ce2aeedfaf805a7ed9007a93c902bc9] | ||
+ | * For VS2015, use the 4.8.7 source [http://download.qt.io/official_releases/qt/4.8/4.8.7/] and apply the patch [https://fami.codefreak.ru/mirrors/qt/unofficial_builds/qt4.8.7-msvc2015/02-fix_build_with_msvc2015-45e8f4ee.diff] | ||
+ | * Launch the msvc2012 command prompt <!-- (MSVC12->Tools->Visual Studio 2012 CommandPrompt) (or: launch cmd.exe and run <code>vcvars32.bat</code>) --> | ||
+ | ** 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" | ||
+ | <!-- | ||
+ | ** Note: Don't start prompt from inside visual studio or it will be an x86 32 bit shell. | ||
+ | --> | ||
+ | |||
+ | |||
+ | * If you want openssl support (optional): | ||
+ | ** Download perl http://strawberryperl.com/ and create a new folder into for example <code>strawberry</code>. | ||
+ | |||
+ | * Configure | ||
+ | ** For debug: <code>configure.exe -platform win32-msvc2012 -debug -opensource -confirm-license -webkit -nomake examples -nomake demos</code> | ||
+ | ** For release: <code>configure.exe -platform win32-msvc2012 -release -opensource -confirm-license -webkit -nomake examples -nomake demos</code> | ||
+ | ** Note: <code>win32-msvc2012</code> is used for both 32 and 64-bit. | ||
+ | ** Note: The option <code>-prefix</code> doesn't work on Windows. | ||
+ | |||
− | + | * Build using <code>nmake</code> | |
− | + | ** Alternatively you can use jom (much faster) | |
− | + | *** Download jom and create a new folder into for example <code>jom</code>. | |
− | + | *** Add this new folder into the path (system properties) | |
− | + | *** Build using <code>jom -jn</code> | |
− | + | **** Note: n is the number of cores of your CPU, so adapt it. | |
− | |||
− | |||
− | |||
− |
Latest revision as of 23:40, 4 August 2017
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.
Mac with Homebrew
As an alternative to the binary, you can install QT 4.8.7 with homebrew on mac 10.12:
brew tap cartr/qt4 brew tap-pin cartr/qt4 brew install qt@4 brew install qt-webkit@2.3
Windows
- 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 binary downloads are usable for older Visual Studio versions (but not for the currently official Visual Studio 2013 version): binary. If you use .7z varaints extract them in the default location C:\Qt\ otherwise that installation will not be properly configured for use with CMake.
- Debug/release mode builds: The recommendation for developers is to build Slicer and Qt at least in Debug mode. To be able to test real-world performance, developers should also build Qt and Slicer in release mode (in a separate build tree), because some algorithms are 10x or more faster in release mode.
- Rationale: 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 to be able to use the Qt Designer.
- 32/64-bit builds: When using 32-bit builds, the available memory space is so limited that the application would run out of memory and crash even working with average-sized data sets. Therefore 64-bit build is recommended for general use. 32-bit applications should only be used when running 3D Slicer on 32-bit operating system (such as a tablet with 32-bit Windows), working with limited-size problems (simple surfaces, image slices, low-resolution image volumes).
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 | VS2013 | ||
64bits | 64bits | 64bits | 64bits | 64bits | 64bits | |
Qt source link | 4.8.6 | 4.7.4 | 4.8.6 | 4.8.6 | 4.8.6 | 4.8.7 |
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.io/browse/QTBUG-32237. Patch: https://gist.github.com/ejtttje/7163a9ced64f12ae9444.
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
For current official version (using VS2013), use one-liner build command.
Manual build instructions for older (not officially supported) configurations
Use a windows extracter to unzip the Qt archive (don't use cygwin unzip it), and follow the instructions below.
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)