| The goal of the CMake Super-Build is to provide a cross-platform build system that allows developers to quickly install and configure the multiple packages.
Where Slicer3's build system relied on a custom build script called getbuildtest, new features added to CMake, partly driven by slicer's requirements, allow porting of the scripts to rely more on native CMake functionality with the benefit that build script is more modular and general purpose.
- 1 PREREQUISITES
- 2 CHECKOUT slicer source files
- 3 CONFIGURE and generate Slicer solution files
- 4 BUILD Slicer4
- 5 RUN Slicer
- 6 DEBUG Slicer
- 7 Common errors
- 7.1 error: ‘class QList<QString>’ has no member named ‘reserve’
- 7.2 libarchive.so: undefined reference to `SHA256_Update'
- 7.3 A tool returned an error code from "Performing configure step for ..."
- 7.4 A tool returned an error code from "Performing download step (git clone) for ..."
- 7.5 No rule to make target `/usr/lib/x86_64-linux-gnu/libGL.so'
- 8 Platform Notes
CHECKOUT slicer source files
You have two options:
To make review and integration of your welcome contributions, we recommends the use of
| While it is not enforced, we strongly recommend you to AVOID the use of SPACES for both the
cd MyProjects svn co http://svn.slicer.org/Slicer4/trunk Slicer4
git clone git://github.com/Slicer/Slicer.git cd Slicer git svn init http://svn.slicer.org/Slicer4/trunk git update-ref refs/remotes/git-svn refs/remotes/origin/master git svn rebase
Consider reading the following page: Slicer guide to
CONFIGURE and generate Slicer solution files
You can configure and generate Slicer solution files using either
- Configure using default options.
- If you downloaded the Qt binary then
qmakewill be detected and all paths will be set automatically.
- If you built your own Qt (e.g. in Debug mode for use with the designer) set the
QT_QMAKE_EXECUTABLEshould be set to the path of the qmake.exe file, which is inside the bin directory (for example,
- Windows doesn't support path longer than 260 characters, please make sure that the total path name of your
Slicer-builddirectory is no longer than 50 characters ( for example
c:\work\Slicer\Slicer-Superbuild(32 characters) is fine)
- Configure using the following commands. By default CMAKE_BUILD_TYPE is set to Debug.
mkdir Slicer4-SuperBuild cd Slicer4-SuperBuild ccmake ../Slicer4
- Usually, using top-level directory name like
- If you build your own Qt, then the
ccmakecommand 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
One of them is in the top-level bin directory
Slicer4-Superbuild and the other one is in the subdirectory
- The first project in
Slicer4-Superbuildmanages 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.
- The second project in
Slicer4-Superbuild/Slicer-buildis 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-buildis necessary (the external libraries are considered built and up to date).
- Warning: An important amount of disk space is required to compile Slicer in Debug (>10GB on Windows)
Workaround firewall blocking git protocol
- Some firewall will be blocking the git protocol, a possible workaround is to configure Slicer disabling the option
Slicer_USE_GIT_PROTOCOL. Then http protocol will be used instead. Consider also reading https://github.com/commontk/CTK/issues/33
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=TRUEwhen configuring Slicer.
- Same applies for OpenSSL:
CMAKE_DISABLE_FIND_PACKAGE_OpenSSL:BOOL=TRUEcan be passed when building Slicer for packaging.
After configuration, start the build process in the
Slicer4-SuperBuild\Slicer.slnin Visual Studio
- Select your build configuration. Usually Release of Debug
- Build the
- If you make local changes to Slicer4, open the solution file located in the directory
Slicer4-SuperBuild/Slicer-buildinstead. You should then be able to either build all projects or just a specific one.
cd ~/Projects/Slicer4-SuperBuild make -j<NUMBEROFCORES>
- Make sure you build Slicer using the Debug configuration.
- Open a windows terminal
- Execute the following command:
cd \path\to\Slicer4-SuperBuild\Slicer-build Slicer.exe --VisualStudio Slicer.sln
error: ‘class QList<QString>’ has no member named ‘reserve’
/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.
libarchive.so: undefined reference to `SHA256_Update'
Linking CXX executable ../../../../../bin/MRMLLogicCxxTests /home/benjaminlong/work/slicer/Slicer4-Superbuild-Debug/LibArchive-install/lib/libarchive.so: undefined reference to `SHA256_Update' /home/benjaminlong/work/slicer/Slicer4-Superbuild-Debug/LibArchive-install/lib/libarchive.so: undefined reference to `SHA256_Final' /home/benjaminlong/work/slicer/Slicer4-Superbuild-Debug/LibArchive-install/lib/libarchive.so: undefined reference to `SHA256_Init' /home/benjaminlong/work/slicer/Slicer4-Superbuild-Debug/LibArchive-install/lib/libarchive.so: undefined reference to `MD5_Init'
cd Slicer-superbuild rm -rf LibArchive-* make -j4
A tool returned an error code from "Performing configure step for ..."
CMake has some problems building complex projects on Windows7. See more details in: http://cmake.org/Bug/view.php?id=12957
A fix has been already identified and soon will be available in an official CMake release (probably 2.8.8). Until then this unofficial version can be used (based on CMake-2.8.7): https://qshare.queensu.ca/Users01/lasso/public/cmake-126.96.36.19957-win32-x86.exe
A tool returned an error code from "Performing download step (git clone) for ..."
CMake has problems cloning git repositories on Windows7. See more details in http://cmake.org/Bug/view.php?id=12564
If you think the described problem is the same as you have, please add your specific error message to the bug report (the more people report the problem the sooner it will be fixed).
No rule to make target `/usr/lib/x86_64-linux-gnu/libGL.so'
- 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