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

From Slicer Wiki
Jump to: navigation, search
(Created page with '* How to build Qt ? Configure options common to all platform: Check our different tutorials: '''''Recommended:''' download the pre-compiled Qt unless you know you need to buil…')
 
Line 1: Line 1:
* How to build Qt ?
+
Configure options are common to all platforms.
 
 
Configure options common to all platform:
 
  
 
Check our different tutorials:  
 
Check our different tutorials:  
 
'''''Recommended:''' download the pre-compiled Qt unless you know you need to build from source to use the Qt Designer''
 
'''''Recommended:''' download the pre-compiled Qt unless you know you need to build from source to use the Qt Designer''
* Build Qt on Windows
+
*<font color="red">Build Qt on Windows </font>
 
** 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.
 
** 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.
 
*# Use a windows extracter to unzip the [#Prerequisites|Qt zip archive], don't use cygwin unzip it.
 
*# Use a windows extracter to unzip the [#Prerequisites|Qt zip archive], don't use cygwin unzip it.
Line 17: Line 15:
 
*#* 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: 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]].
 
*#* 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]].
* Build Qt on Linux
+
*<font color="red">Build Qt on Linux</font>
 
**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
Line 35: Line 33:
 
** 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 (?)
  
* Build Qt on Mac
+
*<<font color="red">Build Qt on Mac</font>
 
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)
 
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)

Revision as of 14:40, 15 June 2011

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

Configure options are common to all platforms.

Check our different tutorials: Recommended: download the pre-compiled Qt unless you know you need to build from source to use the Qt Designer

  • Build Qt on Windows
    • 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.
    1. Use a windows extracter to unzip the [#Prerequisites|Qt zip 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)
    3. build with configure.exe -platform win32-msvc2008 -debug
      • When asked, choose open source license type (o), then accept the license (y)
      • Note: the option -prefix doesn't work on Windows.
      • Note: According to [1] 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.
    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].
  • Build Qt on Linux
    • 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

The following descriptions are given for people who want to compile Qt anyway.

mkdir Qt
mkdir Qt-build
cd Qt
wget http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.6.3.tar.gz
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 
make -j 16
make install
    • Note: On a 64 bit system, you may have to add -arch x86_64 to the Qt configure command line (?)
  • <Build Qt on Mac

Same as Linux. Use the flag -cocoa on the configure command-line(the -shared flag should be set automatically); for a 64 bit build on SnowLeopard use -arch x86_64. For more information go to http://doc.qt.nokia.com/4.6/developing-on-mac.html (warning default values are different: -carbon vs -cocoa for Qt 4.7: http://doc.qt.nokia.com/4.7/developing-on-mac.html)