Documentation/4.10/Developers/Build Instructions
For the latest Slicer documentation, visit the read-the-docs. |
Contents
- 1 PREREQUISITES
- 2 CHECKOUT slicer source files
- 3 CONFIGURE and generate Slicer solution files
- 4 BUILD Slicer
- 5 RUN Slicer
- 6 TEST Slicer
- 7 PACKAGE Slicer
- 8 Common errors
- 8.1 CMake complains during configuration
- 8.2 A tool returned an error code from "Generating vtksysProcessFwd9xEnc.c"
- 8.3 error: ‘class QList<QString>’ has no member named ‘reserve’
- 8.4 libarchive.so: undefined reference to `SHA256_Update'
- 8.5 No rule to make target `/usr/lib/x86_64-linux-gnu/libGL.so'
- 8.6 X11 Window errors at start time
- 8.7 error C2061: syntax error : identifier 'ssize_t'
- 8.8 ld: framework not found QtWebKit
- 8.9 On MacOSX 10.8, CMake hangs forever
- 8.10 On MacOSX 10.8/10.9 with XQuartz, 'X11/Xlib.h' file not found
- 8.11 svn: E175002: Unable to connect to a repository at URL XXX
- 8.12 My antivirus software reports that files in my build directory are infected
- 8.13 Visual Studio compiler crashes
- 8.14 'QSslSocket' : is not a class or namespace name
- 8.15 error: Missing Qt module QTWEBKIT
- 8.16 error when starting Slicer: NameError: name 'getSlicerRCFileName' is not defined
- 8.17 macOS: error while configuring PCRE: "cannot run C compiled program"
- 9 Quick Build on Debian
- 10 Quick Build on Fedora 20
PREREQUISITES
For all systems be sure git-lfs is properly installed for use with VTKv9 (required for VTKm checkout)
As of early 2018, Slicer migrated to Qt5. See instructions at this labs page for the new requirements: https://www.slicer.org/wiki/Documentation/Labs/Qt5-and-VTK8
The prerequisites listed below are required to be able to configure/build/package/test Slicer.
Linux
- CMake >= 3.7-rc02
- Git >= 1.7.10
- Svn >= 1.7
- Qt 5.11: tested and recommended
- To build Slicer: install Qt using the distribution package manager.
- To package and redistribute Slicer: download and execute qt-unified-linux-x64-online.run, install Qt, make sure to select qtscript and qtwebengine components.
- Qt 4.8.7. See details here. See some history here (Note that any version >= Qt 4.7.4 can be used only for Ubuntu < 12.04)
- GCC suite
Debian
- Debian squeeze/wheezy/testing(jessie) users, start by pasting the following lines in a terminal
sudo apt-get install subversion git-core git-svn sudo apt-get install build-essential libx11-dev libxt-dev libgl1-mesa-dev libosmesa6-dev libglu1-mesa-dev libfontconfig-dev libxrender-dev libncurses5-dev sudo apt-get install cmake sudo apt-get install qt-sdk
Ubuntu
Common Prerequisites
sudo apt-get install subversion git-core git-svn
sudo apt-get install make gcc g++ libx11-dev libxt-dev libgl1-mesa-dev libglu1-mesa-dev libfontconfig-dev libxrender-dev libncurses5-dev
sudo apt-get install libosmesa6-dev # Only for Ubuntu < 14.04.3
- On Ubuntu 14.04.3 LTS, attempting to install libosmesa6-dev results in an error.
The following packages have unmet dependencies: libosmesa6-dev : Depends: libosmesa6 (= 10.1.3-0ubuntu0.4) but it is not going to be installed E: Unable to correct problems, you have held broken packages.
For more details, see Bug 1424059.
- Slicer compiles successfully without that package, but VTK_OPENGL_HAS_OSMESA is disabled.
- For Qt5.5 on Ubuntu 16.04
sudo apt-get install libgstreamer-plugins-base0.10-dev
CMake
- Open a terminal and copy the command reported below
- Download stable version of CMake and extract the archive:
sudo apt-get install curl mkdir ~/Support && cd ~/Support curl -O https://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz tar -xzvf cmake-3.8.2-Linux-x86_64.tar.gz
- Create symbolic links into
~/bin
mkdir -p ~/bin for name in cmake ctest cpack ccmake cmake-gui; do ln -s ~/Support/cmake-3.8.2-Linux-x86_64/bin/$name ~/bin/$name done
- You MUST download the standard CMake binary because the distributed version of CMake cannot be used to build slicer.
See here for more details.
Qt 4 (deprecated)
Ubuntu 14.04 and above: Qt 4 == 4.8.7 MUST be used.
See https://github.com/jcfr/qt-easy-build
or on ubuntu 16.04 and 16.10, you can also install qt4.8.7 with:
sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui libqtwebkit-dev
or if that fails (due to libqt4-core and libqt4-gui packages not found):
sudo apt-get install qt4-dev-tools libqt4-dev libqtcore4 libqtgui4 libqtwebkit-dev
Ubuntu 12.04, 12.10, 13.04 and 13.10: Qt 4 >= 4.8.5 MUST be used.
cd ~/Support # This is where we will build Qt and dependent libraries # Keep track of our working directory cwd=$(pwd) # This will download, then build zlib and openssl in the current folder rm -f get-and-build-openssl-for-slicer.sh wget https://gist.githubusercontent.com/jcfr/9513568/raw/004d4af8829c95690da2af51eaa3f0c64b7c4e02/get-and-build-openssl-for-slicer.sh chmod u+x get-and-build-openssl-for-slicer.sh ./get-and-build-openssl-for-slicer.sh # This will download Qt source in the current folder wget http://packages.kitware.com/download/item/6175/qt-everywhere-opensource-src-4.8.6.tar.gz echo "2edbe4d6c2eff33ef91732602f3518eb qt-everywhere-opensource-src-4.8.6.tar.gz" > qt-everywhere-opensource-src-4.8.6.tar.gz.md5 md5sum -c qt-everywhere-opensource-src-4.8.6.tar.gz.md5 # This will configure and build Qt in RELEASE against the zlib and openssl previously built tar -xzvf qt-everywhere-opensource-src-4.8.6.tar.gz mv qt-everywhere-opensource-src-4.8.6 qt-everywhere-opensource-release-src-4.8.6 mkdir qt-everywhere-opensource-release-build-4.8.6 cd qt-everywhere-opensource-release-src-4.8.6 ./configure -prefix $cwd/qt-everywhere-opensource-release-build-4.8.6 \ -release \ -opensource -confirm-license \ -no-qt3support \ -webkit \ -nomake examples -nomake demos \ -openssl -I $cwd/openssl-1.0.1e/include -L $cwd/openssl-1.0.1e \ && make -j7 && make install
For more details, consider reading the FAQ entry: Why Qt 4 >= 4.8.5 should be used on Ubuntu 12.04 and above ?
CentOS
See instructions reported in qt5-centos7/Dockerfile
MacOSX
- XCode command line tools must be installed:
xcode-select --install
- El Capitan is what most developers use.
- CMake 3.7-rc02 is recommended. Check the minimum required CMake version here
- Qt 5: tested and recommended.
- For building Slicer: download and execute qt-unified-mac-x64-online.dmg, install Qt 5.10, make sure to select qtscript and qtwebengine components.
- For packaging and redistributing Slicer: build Qt using qt-easy-build
MacOSX 10.9.4 (Mavericks)
(1) Make sure to install this update: http://support.apple.com/kb/DL1754
(2) Use CMake 3.0.1 - it is known to be working and is supported (if you want to use CMake already installed on your system, 2.8.12.2 is known to work on Mac OS X 10.9.5)
- Mac Os X >= 10.5 (Leopard)
- CMake >= 2.8.9
- For Mac Os X >= 10.8 (Mountain Lion) and/or recent XCode >= 4.5.X - CMake >= 2.8.11 is required. See http://www.cmake.org/files/v2.8/cmake-2.8.11-Darwin64-universal.tar.gz
$ curl -O http://www.cmake.org/files/v2.8/cmake-2.8.11-Darwin64-universal.tar.gz $ tar -xzvf cmake-2.8.11-Darwin64-universal.tar.gz --strip-components=1
$ CMake\ 2.8-11.app/Contents/bin/cmake --version cmake version 2.8.11
- Git >= 1.7.10
- Svn >= 1.7
- XCode (for the SDK libs)
- After installing XCode, install XCode command line developer tools:
xcode-select --install
- XQuartz - For Mac Os X >= 10.8 (Mountain Lion) install XQuartz (http://xquartz.macosforge.org) to get X11 (no longer a default in OS X).
- Qt 4 >= 4.8.5. We recommend you install the following two packages:
- Download and install qt-opensource-mac-4.8.6-1.dmg
- Download and install qt-opensource-mac-4.8.6-1-debug-libs.dmg
- For more details here
Mac OSX 10.11 (El Capitan)
XCode up to version 7 is known to work for Slicer compilation. XCode 8 breaks things on several levels for now. Remember to install XCode command line tools (see above) if a reinstall for XCode is needed.
The standard Qt4 installers fail on this version and the 4.8.6 source code won't build. But as described on the slicer-devel mailing list it is possible to install the homebrew version of qt4 which patches it to work on El Capitan (see below).
- Install the OS, Xcode, and XQuartz (see MacOSX 10.10 above)
- Install Qt4 by running the following two commands:
brew install qt4 xcode-select --install
- TCL does not build correctly on El Capitan as of 2015-12-03, so when building Slicer turn `Slicer_USE_PYTHONQT_WITH_TCL` off.
Mac OSX 10.12 (Sierra)
Similar to 10.11 (El Capitan), there are new issues with Qt4 (caused by Phonon). The GitHub user Cartr offered a patch to the brew team, and even though it was not integrated (the homebrew team decided to stop patching their recipe to encourage people to use Qt5), he turned his formula into a tap that can be installed (see below).
Follow instructions for 10.11 (Installing Xcode, XQuartz, run without TCL) but install Qt4 like shown below instead:
brew install cartr/qt4/qt xcode-select --install
Confirmed with Xcode:
- Version 8.1 (8B62) and cmake version 3.4.20151021-g8fbc8e
- Version 8.3.3 and cmake 3.5.2
Windows
Common Prerequisites
- CMake >= 3.0 (3.7.1 recommended)
- Git >= 1.7.10
- For convenience, you could update the PATH variable so that git can be automatically discovered when configuring Slicer. If not, you will have to specify the GIT_EXECUTABLE at configure time.
- Subversion (SVN) client: any SVN client that has command line tools
- SlikSvn , or
- TortoiseSVN - make sure you install Command line client tools component (disabled by default)
- NSIS (optional): Needed if packaging Slicer - Click here to download. Make sure you install the language packs.
- Qt:
- Qt5 recommended and officially supported. Download qt-unified-windows-x86-online.exe and install Qt along with qtscript and qtwebengine components. For building with VS2015, Qt version 5.10.x or older is required. For more details, read step-by-step guide.
- Qt 4: will still work until Slicer-4.10 but not officially supported. See details here.
Tested and recommended build environment
- VS2015
- Make sure you enable installation of component Programming languages / Visual C++ / Common Tools for Visual C++ 2015 (in some distributions, this option is not enabled by default)
- Installation of Cumulative Servicing Release for Microsoft Visual Studio 2015 Update 3 (KB3165756) is required on some older VS2015 distributions
- Qt 5.10
- CMake >= 3.3.1
Experimental/deprecated build environments
- Visual Studio 2017 (Community or any other edition) with VS2015 build tools (tested, works well)
- When configuring Visual Studio installer, enable installation of component VC++ 2015.3 v14.00 (v140) toolset for desktop
- Visual Studio 2015 toolset must be set in CMake: Optional toolset to use (argument to -T) need to be set to v140
- Visual Studio 2013 with Update 5 (deprecated, should still work)
- As of commit 7160260: Slicer compilation is successful, with some caveats.
- Build Qt 4.8.7 with SSL support using qt-easy-build.
- Note: be sure to pick the version of qmake that you built in the earlier steps if applicable (CMake may pick a different qmake, for example if installed with anaconda)
- VS2012 (untested, may work)
- Use a desktop version such as Visual Studio 2012 Express for Windows Desktop and remember Visual Studio 2012 Update 2). Do not use Visual Studio Express 2012 for Windows 8. You must install Windows SDK, otherwise CMake will not even find the C compiler during configure. In CMake, choose Visual Studio 11 Win64 as generator.
- VS2010 (untested, probably does not work)
- Microsoft Visual Studio 2010 (Any edition)
- Make sure to build or install:
- Qt 4.8
- Make sure to install:
- VS2008 (untested, probably does not work)
- Microsoft Visual Studio 9 2008 (Any edition). VS Express 2008 with SP1 direct link (functional as of Jan 11, 2014)
- Make sure to install SP1: Click here to download SP1 and click here to understand the motivation.
- Make sure to patch VS2008 using the script fix-vc9-redist-manifests.ps1
- Cygwin (untested, probably does not work)
- Cygwin suite (building with cygwin gcc not supported, but the cygwin shell environment can be used to run git, svn, etc).
CHECKOUT slicer source files
Check out the code using git
and configure the git svn
bridge:
- While it is not enforced, we strongly recommend you to AVOID the use of SPACES for both the
source directory
and thebuild directory
. We mean it.
- Due to maximum path length limitations during build the build process, source and build folders must be located in a folder with very short total path length. This is expecially critical on Windows. For example, C:\D\S4 for source and C:\D\S4R for release-mode build folder works.
-
Clone the github repository
cd MyProjects git clone git://github.com/Slicer/Slicer.git
The
Slicer
directory is automatically created after cloning Slicer. -
Setup the development environment:
cd Slicer ./Utilities/SetupForDevelopment.sh
For more details see Development With Git.
On Windows enter the commands above in to a bash shell, such as Git Bash (part of msysgit) or use a Git client with a graphical user interface.
-
Configure the
git svn
bridge to ensure the mapping with svn revision.git-svn is only required for core developers with svn access - other people can skip it.
cd Slicer git svn init http://svn.slicer.org/Slicer4/trunk git update-ref refs/remotes/git-svn refs/remotes/origin/master git checkout master git svn rebase
Note for Mac OSX El Capitan:
You might need to link SVN from XCode if you find that git svn
is broken. To get correct links and bypass El Capitan's SIP use these commands
sudo mkdir /Library/Perl/5.18/auto sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/SVN /Library/Perl/5.18/darwin-thread-multi-2level sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi-2level/auto/SVN /Library/Perl/5.18/auto/
If you plan to compile Slicer to develop your own extensions and test these extensions on Slicer releases, it is convenient to download the source code directly from SVN and specify the revision number corresponding to the release you want. To do so, replace <MARKER> and <SVNREVISION> in the command below with the selected revision and marker:
svn co http://svn.slicer.org/Slicer4/<MARKER> Slicer-r<SVNREVISION> -r <SVNREVISION>
Release SVN revision# Marker 4.8.1 26813 branches/Slicer-4-8 4.8.0 26489 trunk 4.6.2 25516 branches/Slicer-4-6 4.5.0-1 24735 trunk 4.4 23774 trunk 4.3.1 22599 branches/Slicer-4-3 4.3.0 22408 trunk
More corresponding SVN revision numbers can be found here and here. The <MARKER> can be found at the bottom of this page http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=SVNREVISION by replacing SVNREVISION with the selected revision.
For example, to checkout the source code associated with revision 4.8.1, you would use the following command:
svn co http://svn.slicer.org/Slicer4/branches/Slicer-4-8 Slicer-r26813 -r 26813
CONFIGURE and generate Slicer solution files
There are many ways of customizing Slicer's user interface or feature set. This section describes how a custom Slicer build can be configured at build-time. See an overview of various other options in this presentation.
You can configure and generate Slicer solution files using either ccmake
or cmake-gui
.
Customizing application build
Customized editions of Slicer can be generated without changing Slicer source code, just by modifying CMake variables:
- SlicerApp_APPLICATION_NAME: Custom application name to be used, instead of default "Slicer". The name is used in installation package name, window title bar, etc.
- Slicer_DISCLAIMER_AT_STARTUP: String that is displayed to the user after first startup of Slicer after installation (disclaimer, welcome message, etc).
- Slicer_DEFAULT_HOME_MODULE: Module name that is activated automatically on application start.
- Slicer_DEFAULT_FAVORITE_MODULES: Modules that will be added to the toolbar by default for easy access. List contains module names, separated by space character.
- Slicer_CLIMODULES_DISABLED: Built-in CLI modules that will be removed from the application. List contains module names, separated by semicolon character.
- Slicer_QTLOADABLEMODULES_DISABLED: Built-in Qt loadable modules that will be removed from the application. List contains module names, separated by semicolon character.
- Slicer_QTSCRIPTEDMODULES_DISABLED: Built-in scripted loadable modules that will be removed from the application. List contains module names, separated by semicolon character.
- Slicer_USE_PYTHONQT_WITH_OPENSSL: enable/disable building the application with SSL support (ON/OFF)
- Slicer_USE_SimpleITK: enable/disable SimpleITK support (ON/OFF)
- Slicer_BUILD_SimpleFilters: enable/disable building SimpleFilters. Requires SimpleITK. (ON/OFF)
- Slicer_BUILD_EMSegment: enable/disable building EM segmenter (ON/OFF)
- Slicer_USE_PYTHONQT_WITH_TCL: TCL support (ON/OFF)
- Slicer_EXTENSION_SOURCE_DIRS: Defines additional extensions that will be included in the application package as built-in modules. Full paths of extension source directories has to be specified, separated by semicolons.
Per-platform instructions
Windows
Recommended: run CMake (cmake-gui) from the Windows Start menu
- Set the build directory. For example:
C:\Slicer-SuperBuild-Debug
orC:\Slicer-SuperBuild-Release
.- Because Windows doesn't support file path longer than 260 characters and has a maximum command line length, please make sure that the total path name of your
Slicer-build
directory is no longer than 50 characters (for examplec:\work\Slicer\Slicer-SuperBuild
may work). In case of any build error, use very short directory names: C:\S4 for source directory, C:\S4D for debug build, C:\S4R for release build. - You cannot use the same build tree for both release or debug mode builds. If both build types are needed, then the same source directory can be used, but a separate build directory should be created and configured for each build type.
- Because Windows doesn't support file path longer than 260 characters and has a maximum command line length, please make sure that the total path name of your
- Select your compiler: Visual Studio 14 2015 Win64
- Do not configure yet.
- Add
Qt5_DIR
variable pointing to Qt5 folder such asC:\Qt\5.10.0\msvc2015_64\lib\cmake\Qt5
. - Configure
- Click generate then close cmake-gui.
- If building in release mode:
- Open the top-level Slicer.sln file in the build directory in Visual Studio
- Set active configuration to Release. Visual Studio will select Debug build configuration by default when you first open the solution in the Visual Studio GUI. If you build Slicer in release mode and accidentally forget to switch the build configuration to Release then the build will fail. Note: you can avoid this manual configuration mode selection by setting
CMAKE_CONFIGURATION_TYPES
toRelease
in cmake-gui.
- If building in debug mode:
- Start Visual Studio using the Slicer launcher as described in Step-by-step debug instuctions
- Build the ALL_BUILD project
Alternative option: Configure and build using command-line or batch file
Instead of using CMake (cmake-gui), it is also possible to configure by creating a .bat file that contains command-line instructions and run this .bat file each time a Slicer needs to be re-built. The examples below assume Slicer source code is in C:\S4
folder and Qt-5.10 is installed in default location.
Visual Studio 2015 in Release mode:
mkdir C:\D\S4R cd /d C:\D\S4R "C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 14 2015 Win64" -DQt5_DIR:PATH=C:\Qt\5.10.0\msvc2015_64\lib\cmake\Qt5 C:\D\S4 "C:\Program Files\CMake\bin\cmake.exe" --build . --config Release
Visual Studio 2015 in Debug mode:
mkdir C:\D\S4D cd /d C:\D\S4D "C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 14 2015 Win64" -DQt5_DIR:PATH=C:\Qt\5.10.0\msvc2015_64\lib\cmake\Qt5 C:\D\S4 "C:\Program Files\CMake\bin\cmake.exe" --build . --config Debug
Visual Studio 2017 with VS2015 toolset in Release mode:
mkdir C:\D\S4R cd /d C:\D\S4R "C:\Program Files\CMake\bin\cmake.exe" -G "Visual Studio 15 2017 Win64" -DQt5_DIR:PATH=C:\Qt\5.10.0\msvc2015_64\lib\cmake\Qt5 C:\D\S4 "C:\Program Files\CMake\bin\cmake.exe" --build . --config Release
Unix-like
- Recommended:
- Configure using the following commands. By default CMAKE_BUILD_TYPE is set to Debug.
mkdir Slicer-SuperBuild-Debug cd Slicer-SuperBuild-Debug cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DQt5_DIR:PATH=/path/to/Qt5.11.0/5.11.0/gcc_64/lib/cmake/Qt5 ../Slicer
where you replace /path/to/QtSDK with the real path on your machine where QtSDK is located
If using Qt from the system, do not forget to add the following CMake variable to your configuration command line:
-DSlicer_USE_SYSTEM_QT:BOOL=1
- Remarks:
- Instead of
cmake
, you can useccmake
orcmake-gui
to visually inspect and edit configure options. - Using top-level directory name like
Slicer-SuperBuild-Release
orSlicer-SuperBuild-Debug
is recommended. - Step-by-step debug instuctions
- On Mac OS X 10.9 (Mavericks) / 10.10 (Yosemite) / 10.11 (El Capitan), also set the following variables (see discussion):
Variable | Description |
Slicer_USE_PYTHONQT_WITH_TCL | OFF |
CMAKE_OSX_DEPLOYMENT_TARGET | 10.9 or 10.10 or 10.11 |
General information
Two projects are generated by either cmake
, ccmake
or cmake-gui
.
One of them is in the top-level bin directory Slicer-SuperBuild
and the other one is in the subdirectory Slicer-build
:
Slicer-SuperBuild/Slicer-build
- The first project in
Slicer-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) inSlicer-SuperBuild
, which will update and build the external libraries and if successful will then build the subproject Slicer-build. - The second project in
Slicer-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) inSlicer-SuperBuild/Slicer-build
is necessary (the external libraries are considered built and up to date). - Warning: An significant amount of disk space is required to compile Slicer in Debug (>10GB on Windows)
Workaround for if the firewall is blocking git protocol
- Some firewalls will block the git protocol. A possible workaround is to configure Slicer by disabling the option
Slicer_USE_GIT_PROTOCOL
. Then the http protocol will be used instead. Consider also reading https://github.com/commontk/CTK/issues/33
BUILD Slicer
After configuration, start the build process in the Slicer-SuperBuild
directory
Linux or MacOSX (Makefile) | Windows (Visual Studio) |
---|---|
Start a terminal. $ cd ~/Projects/Slicer-SuperBuild $ make -j<NUMBEROFCORES> In case of file download hash mismatch error, you need to acquire the latest wget, and build cmake with OpenSSL turned on. For more information, see here and here |
Start Windows Explorer. Need help?
If you make local changes to Slicer, open the solution file located in the directory |
RUN Slicer
Linux or MacOSX | Windows |
---|---|
Start a terminal. $ Slicer-SuperBuild/Slicer-build/Slicer |
Start Windows Explorer. Need help?
|
Notes:
- Linux Ubuntu: if you have odd rendering artifacts, try disabling visual effects (System/Appearance/Visual Effects)
- Windows: If build was OK, but Slicer doesn't start (e.g. gives the error:
[bin/Release/SlicerQT-real.exe] exit abnormally - Report the problem.
) then one possible root cause is that you have a copy ofPython26.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
TEST Slicer
After building, run the tests in the Slicer-SuperBuild/Slicer-build
directory
Linux or MacOSX (Makefile) | Windows (Visual Studio) |
---|---|
Start a terminal. $ cd ~/Projects/Slicer-SuperBuild/Slicer-build $ ctest -j<NUMBEROFCORES> |
Start Windows Explorer. Need help?
Note: RUN_TESTS project can be found in the CMakePredefinedTargets folder. See here for more details. |
PACKAGE Slicer
Linux or MacOSX (Makefile) | Windows (Visual Studio) |
---|---|
Start a terminal. $ cd ~/Projects/Slicer-SuperBuild $ cd Slicer-build $ make package |
Note: Make sure to patch VS2008 using the script fix-vc9-redist-manifests.ps1
Note: PACKAGE project can be found in the CMakePredefinedTargets folder. See here for more details. |
Common errors
CMake complains during configuration
CMake may not directly show what's wrong; try to look for log files of the form BUILD/CMakeFiles/*.log (where BUILD is your build directory) to glean further information.
A tool returned an error code from "Generating vtksysProcessFwd9xEnc.c"
The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail. Project : error PRJ0019: A tool returned an error code from "Generating vtksysProcessFwd9xEnc.c"
Suggested solution: Install SP1 of Visual Studio
See also:
- "Deploying on Windows with DLL Manifest Issues" (Bill Hoffman, Kitware blog).
- How to create a custom installer to correct a missing WinSXS manifest entry (StackOverflow).
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/Slicer-SuperBuild-Debug/LibArchive-install/lib/libarchive.so: undefined reference to `SHA256_Update' /home/benjaminlong/work/slicer/Slicer-SuperBuild-Debug/LibArchive-install/lib/libarchive.so: undefined reference to `SHA256_Final' /home/benjaminlong/work/slicer/Slicer-SuperBuild-Debug/LibArchive-install/lib/libarchive.so: undefined reference to `SHA256_Init' /home/benjaminlong/work/slicer/Slicer-SuperBuild-Debug/LibArchive-install/lib/libarchive.so: undefined reference to `MD5_Init'
Solution:
cd Slicer-SuperBuild rm -rf LibArchive-* make -j4
Details:
- http://na-mic.org/Mantis/view.php?id=1616
- http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=18923
- http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&revision=18969
No rule to make target `/usr/lib/x86_64-linux-gnu/libGL.so'
See http://techtidings.blogspot.com/2012/01/problem-with-libglso-on-64-bit-ubuntu.html
X11 Window errors at start time
X Error: BadWindow (invalid Window parameter) 3 Extension: 137 (Uknown extension) Minor opcode: 4 (Unknown request) Resource id: 0x4200199 X Error: BadWindow (invalid Window parameter) 3 Extension: 137 (Uknown extension) Minor opcode: 4 (Unknown request) Resource id: 0x42001a6 X Error: BadWindow (invalid Window parameter) 3 Extension: 137 (Uknown extension) Minor opcode: 4 (Unknown request) Resource id: 0x42001b3
Solution:
- Reinstall Nvidia drivers (that also rewrite the xorg.conf file).
error C2061: syntax error : identifier 'ssize_t'
4>1>Compiling... 4>1>version.c 4>1>c:\chene\winbin64\slicer4\cmcurl\urldata.h(585) : error C2061: syntax error : identifier 'ssize_t' 4>1>c:\chene\winbin64\slicer4\cmcurl\urldata.h(593) : error C2365: 'fread' : redefinition; previous definition was 'function' 4>1> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\stdio.h(248) : see declaration of 'fread' 4>1>c:\chene\winbin64\slicer4\cmcurl\urldata.h(610) : error C2059: syntax error : '}'
Solution:
ld: framework not found QtWebKit
[...] Linking CXX shared library libPythonQt.dylib ld: framework not found QtWebKit clang: error: linker command failed with exit code 1 (use -v to see invocation) make[8]: *** [libPythonQt.dylib] Error 1 [...]
See Slicer issue #2860
Workaround:
Solution:
- Use a recent nightly build of CMake. It includes patch cc676c3a. Note also that the coming version of CMake 2.8.11 will work as expected.
On MacOSX 10.8, CMake hangs forever
Issue: http://www.na-mic.org/Bug/view.php?id=2957
Solution: Use CMake build >= 2.8.10.20130220-g53b279. See http://www.cmake.org/files/dev/cmake-2.8.10.20130220-g53b279-Darwin-universal.tar.gz
Details:
CMake folks (Thanks Brad King :)) fixed an issue that was preventing the most recent nightly from being used to successfully compile Slicer. The fix has been tested and is known to work. Tomorrow nightly build of CMake and by extension the coming release of CMake 2.8.11 will work.
If you are curious about the details, check the commit message:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1df09e57 [^]
The associated CMake test have also been updated:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bff3d9ce [^]
On MacOSX 10.8/10.9 with XQuartz, 'X11/Xlib.h' file not found
Issue: http://www.na-mic.org/Bug/view.php?id=3405
Workaround: Build with -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF
Tcl is required only for EMSegment module.
Details: See http://www.na-mic.org/Bug/view.php?id=3405
svn: E175002: Unable to connect to a repository at URL XXX
Issue: Cisco AnyConnect is installed with the "Web Security" option checked (default), which blocks Subversion checkouts even when inactive!
Solution: Uninstall and reinstall Cisco AnyConnect, deselecting the "Web Security" feature during install
My antivirus software reports that files in my build directory are infected
Although usually antivirus software does not interfere with the build process, it is recommended to disable antivirus and search indexing for build directories to improve performance and minimize the chance of concurrent file access problems.
Visual Studio compiler crashes
- If you use Visual Studio 2008, make sure Visual Studio 2008 service pack 1 is installed
- Build Slicer in a short directory, for example source code in C:\S4, binary directory C:\S4D or C:\S4R
'QSslSocket' : is not a class or namespace name
This error message occurs if Slicer is configured to use SSL but Qt is built without SSL support.
Either set Slicer_USE_PYTHONQT_WITH_OPENSSL to OFF when configuring Slicer build in CMake, or build Qt with SSL support.
error: Missing Qt module QTWEBKIT
CMake Error at CMake/SlicerBlockFindQtAndCheckVersion.cmake:43 (message): error: Missing Qt module QTWEBKIT Call Stack (most recent call first): CMake/SlicerBlockFindQtAndCheckVersion.cmake:88 (__SlicerBlockFindQtAndCheckVersion_find_qt) CMakeLists.txt:607 (include)
Solution:
sudo apt-get -y install libqtwebkit-dev
Details:
error when starting Slicer: NameError: name 'getSlicerRCFileName' is not defined
./Slicer Traceback (most recent call last):
File "<string>", line 7, in <module> File "/home/fbudin/Devel/Slicer-SuperBuild-Release/Slicer-build/bin/Python/slicer/slicerqt.py", line 6, in <module> import vtk File "/home/fbudin/Devel/Slicer-SuperBuild-Release/VTKv7-build/Wrapping/Python/vtk/__init__.py", line 41, in <module> from .vtkCommonKit import * File "/home/fbudin/Devel/Slicer-SuperBuild-Release/VTKv7-build/Wrapping/Python/vtk/vtkCommonKit.py", line 9, in <module> from vtkCommonKitPython import *
ImportError: /home/fbudin/Devel/Slicer-SuperBuild-Release/VTKv7-build/lib/./libvtkCommonKitPython27D-7.1.so.1: undefined symbol: PyUnicodeUCS2_DecodeUTF8 Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'getSlicerRCFileName' is not defined Number of registered modules: 138 error: [/home/fbudin/Devel/Slicer-SuperBuild-Release/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.
Solution and details here
macOS: error while configuring PCRE: "cannot run C compiled program"
If the XCode command line tools are not properly set up on OS X, PCRE could fail to build in the Superbuild process with the errors like below:
configure: error: in `/Users/fedorov/local/Slicer4-Debug/PCRE-build': configure: error: cannot run C compiled programs.
To install XCode command line tools, use the following command from the terminal:
xcode-select --install
Quick Build on Debian
sudo aptitude update sudo aptitude install subversion git gcc g++ make cmake-curses-gui libqt4-dev svn co http://svn.slicer.org/Slicer4/trunk Slicer mkdir Slicer-SuperBuild-Debug cd Slicer-SuperBuild-Debug cmake ../Slicer make -j5 # runtime dependency: sudo aptitude install python-tk
Quick Build on Fedora 20
Thanks to Bill Lorensen, you will find below the instruction to quickly build Slicer on Fedora 20:
yum groupinstall "C Development Tools" yum install git-core yum install svn yum install libX11-devel yum install libXt-devel yum install mesa-libGL-devel yum install mesa-libGLU-devel yum install cmake yum install tcl-devel yum install python-devel yum install qt-devel yum install qt-webkit-devel
svn co http://svn.slicer.org/Slicer4/trunk Slicer mkdir Slicer-SuperBuild-Debug cd Slicer-SuperBuild-Debug cmake ../Slicer make -j5
Reference: http://slicer-devel.65872.n3.nabble.com/Fedora-20-Slicer-Experience-tt4030845.html