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

From Slicer Wiki
Jump to: navigation, search
Line 5: Line 5:
 
}}
 
}}
 
<br>
 
<br>
 +
  
 
== Step0: Prerequisites ==
 
== Step0: Prerequisites ==
  
 
* See [[Documentation/{{documentation/version}}/Developers/Build Instructions/Prerequisites]]
 
* See [[Documentation/{{documentation/version}}/Developers/Build Instructions/Prerequisites]]
 +
  
 
== Step1: Checkout slicer source files using subversion  ==
 
== Step1: Checkout slicer source files using subversion  ==
Line 15: Line 17:
 
  svn co [http://svn.slicer.org/Slicer4/trunk http://svn.slicer.org/Slicer4/trunk] Slicer4
 
  svn co [http://svn.slicer.org/Slicer4/trunk http://svn.slicer.org/Slicer4/trunk] Slicer4
 
Alternatively, you can control the repository using '''git-svn'''. See the [[Slicer:git-svn|git-svn]] page for more information.
 
Alternatively, you can control the repository using '''git-svn'''. See the [[Slicer:git-svn|git-svn]] page for more information.
 +
  
 
== Step2: Configure and generate Slicer solution files ==
 
== Step2: Configure and generate Slicer solution files ==
Line 46: Line 49:
 
By default, if CMake finds Java on your machine, it automatically builds Java CLIs. If you don't want any Java in your Slicer (or if you don't want to install Java on your Mac Os X), you can pass <code>-DCMAKE_DISABLE_FIND_PACKAGE_Java:BOOL=TRUE</code> when configuring Slicer.
 
By default, if CMake finds Java on your machine, it automatically builds Java CLIs. If you don't want any Java in your Slicer (or if you don't want to install Java on your Mac Os X), you can pass <code>-DCMAKE_DISABLE_FIND_PACKAGE_Java:BOOL=TRUE</code> when configuring Slicer.
 
Same applies for OpenSSL: <code>CMAKE_DISABLE_FIND_PACKAGE_OpenSSL:BOOL=TRUE</code> can be passed when building Slicer for packaging.
 
Same applies for OpenSSL: <code>CMAKE_DISABLE_FIND_PACKAGE_OpenSSL:BOOL=TRUE</code> can be passed when building Slicer for packaging.
 +
  
 
== Step3: Build Slicer4 ==
 
== Step3: Build Slicer4 ==
Line 66: Line 70:
 
==Step4: Run Slicer4 ==
 
==Step4: Run Slicer4 ==
 
Run the launcher in Slicer4-SuperBuild/Slicer-build/Slicer (Slicer.exe on windows)
 
Run the launcher in Slicer4-SuperBuild/Slicer-build/Slicer (Slicer.exe on windows)
 +
  
 
== Common errors ==
 
== Common errors ==
Line 72: Line 77:
 
  /nfs/Users/blowekamp/QtSDK/Desktop/Qt/474/gcc/include/QtCore/qdatastream.h:246: error: ‘class QList<QString>’ has no member named ‘reserve’
 
  /nfs/Users/blowekamp/QtSDK/Desktop/Qt/474/gcc/include/QtCore/qdatastream.h:246: error: ‘class QList<QString>’ has no member named ‘reserve’
 
You have multiple Qt versions installed on your machine. Try removing the Qt version installed on the system.
 
You have multiple Qt versions installed on your machine. Try removing the Qt version installed on the system.
 +
  
 
==Platform Notes==
 
==Platform Notes==

Revision as of 21:16, 30 January 2012

Home < Documentation < 4.0 < Developers < Build Instructions

Developers Information



Step0: Prerequisites


Step1: Checkout slicer source files using subversion

For example:

cd MyProjects
svn co http://svn.slicer.org/Slicer4/trunk Slicer4

Alternatively, you can control the repository using git-svn. See the git-svn page for more information.


Step2: Configure and generate Slicer solution files

You can configure and generate Slicer solution files using either ccmake or cmake-gui.

  • cmake-gui (Recommended): Configure using default options.

Note

  1. If you downloaded the Qt binary then qmake will be detected and all paths will be set automatically.
  2. If you built your own Qt (e.g. in Debug mode for use with the designer) set the QT_QMAKE_EXECUTABLE in cmake-gui.QT_QMAKE_EXECUTABLE should be set to the path of the qmake.exe file, which is inside the bin directory (for example, ./QT/qt-everywhere-opensource-src-4.7.3/bin/qmake.exe).
  • ccmake (for linux/mac): Configure using the following commands. For developers, set the CMAKE_BUILD_TYPE to Debug.
mkdir Slicer4-SuperBuild
cd Slicer4-SuperBuild
ccmake ../Slicer4
  • If you build your own Qt, then the ccmake command in the sequence above should also specify the path to that Qt installation. For example,
ccmake -DQT_QMAKE_EXECUTABLE:FILEPATH=<path_to_my_installation_of_qt>/qt-everywhere-opensource-src-4.7.3/bin/qmake ../Slicer4

Two projects are generated by ccmake/cmake-gui. One of them is in the top-level bin directory Slicer4-Superbuild and the other one is in the subdirectory Slicer4-Superbuild/Slicer-build:

  1. The first project in Slicer4-Superbuild manages all the external dependencies of Slicer (VTK, ITK, Python, ...). To build Slicer for the first time, run make (or build the solution file in Visual Studio) in Slicer4-Superbuild, which will update and build the external libraries and if successful will then build the subproject Slicer-build.
  2. The second project in Slicer4-Superbuild/Slicer-build is the "traditional" build directory of Slicer. After local changes in Slicer (or after an svn update on the source directory of Slicer), only running make (or building the solution file in Visual Studio) in Slicer4-Superbuild/Slicer-build is necessary (the external libraries are considered built and up to date).

Warning Warning:

  1. For Windows users:Windows doesn't support path longer than 260 characters, please make sure that the total path name of your Slicer-build directory is no longer than 50 characters ( for example "c:\work\Slicer\Slicer-Superbuild" (32 characters) is fine)
  2. Warning: a lot of space disk is necessary to compile Slicer in Debug (>10GB on Windows)
  • Notes for advanced users

By default, if CMake finds Java on your machine, it automatically builds Java CLIs. If you don't want any Java in your Slicer (or if you don't want to install Java on your Mac Os X), you can pass -DCMAKE_DISABLE_FIND_PACKAGE_Java:BOOL=TRUE when configuring Slicer. Same applies for OpenSSL: CMAKE_DISABLE_FIND_PACKAGE_OpenSSL:BOOL=TRUE can be passed when building Slicer for packaging.


Step3: Build Slicer4

After configuration, start the build process in the Slicer4-SuperBuild directory

  • Linux / Mac: Run the following code:
make -j<NUMBEROFCORES>
  • Windows: Open Slicer4-SuperBuild\Slicer.sln (or Slicer-4.0\Slicer4-SuperBuild\Slicer-build\Slicer.sln) in Visual Studio and build the ALL_BUILD project.


Warning Warning:

  1. As it is indicated in Step2, if you make local changes in Slicer4, run make (or build the solution file in Visual Studio) in the directory Slicer4-Superuild/Slicer-build.
  2. If you would like to make local changes and debug your code in Debug mode in Visual Studio, use the Visual Studio Command Prompt to open the solution file in Slicer4-Superuild/Slicer-build:
    • Open Visual Studio Command Prompt
    • Go to the directory Slicer4-Superuild/Slicer-build
    • Write Slicer.exe --VisualStudio Slicer.sln


Step4: Run Slicer4

Run the launcher in Slicer4-SuperBuild/Slicer-build/Slicer (Slicer.exe on windows)


Common errors

/nfs/Users/blowekamp/QtSDK/Desktop/Qt/474/gcc/include/QtCore/qdatastream.h: In function ‘QDataStream& operator>>(QDataStream&, QList<T>&) [with T = QString]’:
/nfs/Users/blowekamp/QtSDK/Desktop/Qt/474/gcc/include/QtCore/qstringlist.h:247:   instantiated from here
/nfs/Users/blowekamp/QtSDK/Desktop/Qt/474/gcc/include/QtCore/qdatastream.h:246: error: ‘class QList<QString>’ has no member named ‘reserve’

You have multiple Qt versions installed on your machine. Try removing the Qt version installed on the system.


Platform Notes

  • Linux Ubuntu: if you have odd rendering artifacts, try disabling visual effects (System/Appearance/Visual Effects)
  • Windows: If build was OK, but it Slicer doesn't start (gives the error: [bin/Release/SlicerQT-real.exe] exit abnormally - Report the problem.) then one possible root cause is that you have a copy of Python26.dll in your windows system directory (e.g., c:\Windows\System32\python26.dll). The solution is to rename or remove the python dll in the system directory. See more details here: http://www.na-mic.org/Bug/view.php?id=1180