Documentation/Nightly/Developers/Build Instructions/Prerequisites

From Slicer Wiki
Revision as of 14:22, 1 June 2020 by Sam.horvath (talk | contribs) (→‎Common Prerequisites: Add example Qt 5 guide)
Jump to: navigation, search
Home < Documentation < Nightly < Developers < Build Instructions < Prerequisites


For the latest Slicer documentation, visit the read-the-docs.


PREREQUISITES

As of early 2018, Slicer migrated to Qt5. Qt4 support was removed in version 4.11. 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.13.4
  • 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.
  • 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 libxkbcommon-x11-0


sudo apt-get install libosmesa6-dev  # Only for Ubuntu < 14.04.3
  1. 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.

  1. 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
  1. Open a terminal and copy the command reported below
  2. 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.13/cmake-3.13.4-Linux-x86_64.tar.gz
    tar -xzvf cmake-3.13.4-Linux-x86_64.tar.gz
    
  3. Create symbolic links into ~/bin
    mkdir -p ~/bin
    for name in cmake ctest cpack ccmake cmake-gui; do
      ln -s ~/Support/cmake-3.13.4-Linux-x86_64/bin/$name ~/bin/$name
    done
    
  1. You MUST download the standard CMake binary because the distributed version of CMake cannot be used to build slicer.
    See here for more details.

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.12.2 is recommended. Check the minimum required CMake version here
  • Large File Storage for git is required. (brew install git-lvs)
  • 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
  • Setting CMAKE_OSX_DEPLOYMENT_TARGET CMake variable specifies the minimum macOS version a generated installer may target.  So it should be equal to or less than the version of SDK you are building on. Note that the SDK version is set using CMAKE_OSX_SYSROOT CMake variable automatically initialized during CMake configuration.

MacOSX 10.9.4 (Mavericks)

(1) Make sure to install this update: http://support.apple.com/kb/DL1754

(2) Use CMake 3.12.2 - 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)

$ 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

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


Mac OSX 10.14 (Mojave)

Associated discussion topic is https://discourse.slicer.org/t/building-on-mac-10-14-mojave/4554/21

  • Install XCode:
xcode-select --install


  • Build qt from homebrew
brew install qt
ccmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.14 -DQt5_DIR=/usr/local//Cellar/qt/5.13.2/lib/cmake/Qt5 ~/slicer/latest/Slicer

  • Explicitly set the SDK when running make
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk make -j20

Note if you have build errors in dcmtk related to iconv symbols, you may need to uninstall the icu4c and dcmtk homebrew packages during the build process. See here and here.

Windows

Common Prerequisites

  • CMake >= 3.15.1
  • Git >= 1.7.10
    • Note CMake must be able to find git.exe and patch.exe. If git is installed in the default location then they may be found there, but if they are not found then either add the folder that contains them to PATH environment variable; or set GIT_EXECUTABLE and Patch_EXECUTABLE as environment variables or as CMake variables 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.
  • Qt5: Download download Qt universal installer from here and install Qt 5.15 along with qtscript and qtwebengine components. For and examples of the installation procedure, read this step-by-step guide.

Tested and recommended build environment

  • VS2017 (Visual Studio 15 2017 Win64)
  • VS2019 (Visual Studio 16 2019 Win64)
  • Older VS toolsets can be used with newer IDES
    • When configuring Visual Studio installer, enable installation of Visual Studio 2017 (v141) or Visual Studio 2015 (v140) toolsets
    • For older toolsets, must be set in CMake: Optional toolset to use (argument to -T) need to be set to v141 or v140
    • Make sure you enable installation of component Programming languages / Visual C++ / Common Tools for Visual C++ (in some distributions, this option is not enabled by default)
  • Qt 5.15
  • CMake >= 3.15.1

Experimental/deprecated build environments

  • VS2015 (Visual Studio 14 2015 Win64) Update 3
    • Requires Qt 5.10.x to build due to QtWebEngine. For more details, read step-by-step guide to download and install.
  • 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).