Building Slicer with gcc 6

I am currently running Debian 9 and I’m trying to rebuild Slicer with gcc 6 which is the default in Debian 9.

I was originally trying to rebuild the stable Slicer 4.6.2 build but came across the issues that were mentioned here resolving all except the issue with ITK and ctk+11: https://issues.slicer.org/view.php?id=4268

I then tried building stable Slicer 4.8 but was unable to do so with Qt 4.8.7, and I must be doing something wrong building Qt5 because QtWebEngine remains unbuilt.

Is there a recommended/known revision of Slicer/Qt/Vtk that is known to work with Debian and gcc 6? I’m not particularly picky as long as it’s around 4.5 and up.

Thanks in advance

Hi Franklin,

Here is how I managed to build Slicer on Debian 9. (This is git HEAD
rather than stable, so YMMV.)

First, edit the top of CMakeLists.txt to be this:

set(_msg "Setting C++ standard")
message(STATUS "${_msg} - C++")
if(NOT DEFINED CMAKE_CXX_STANDARD)
  if("${Slicer_VTK_VERSION_MAJOR}" STREQUAL "8" OR DEFINED Qt5_DIR)
    set(CMAKE_CXX_STANDARD 11)
  else()
    set(CMAKE_CXX_STANDARD 98)
  endif()
endif()
# Since SimpleITK requires CMP0067 to properly support C++11, requires
# the corresponding CMake version.
if(CMAKE_CXX_STANDARD EQUAL 11 AND CMAKE_VERSION VERSION_LESS "3.8.2")
  if (NOT DEFINED Slicer_USE_SimpleITK OR Slicer_USE_SimpleITK)
    message(FATAL_ERROR "CMake >= 3.8.2 is required to enable C++11
support")
  endif()
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
message(STATUS "${_msg} - C++${CMAKE_CXX_STANDARD}")

Next, edit External_OpenSSL.cmake to be this:

    set(OPENSSL_DOWNLOAD_VERSION "1.0.2l" CACHE STRING "Version of
OpenSSL source package to download")
    set(OpenSSL_1.0.2l_URL https://www.openssl.org/source/openssl-1.0.2
l.tar.gz)
    set(OpenSSL_1.0.2l_MD5 f85123cd390e864dfbe517e7616e6566)

Finally, configure like this:

cmake \
    -DQt5_DIR:PATH=/usr/lib/x86_64-linux-gnu/cmake/Qt5/ \
    -DSlicer_VTK_VERSION_MAJOR=8 \
    -DCMAKE_CXX_STANDARD=11 \
    -DSlicer_USE_SimpleITK:BOOL=OFF \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_TESTING:BOOL=OFF \
    ../Slicer

Good luck!
Greg

1 Like

Also please use 4.8 instead, as 4.6.2 is more than a year old, and there is no point trying anything with such an old version.

Hi Greg,

Thanks, I’ll try that out! Did you use Qt5 built from source (and if so via JC’s easy build?) or another package?

Hi Franklin,

No. I use Debian’s qt5 packages. In Debian 9 it is Qt 5.7.1.

Update 2017-11-16. Following packages are needed:

qt5-qmake
libqt5webkit5-dev
qtmultimedia5-dev
qttools5-dev-tools
qttools5-dev
libqt5xmlpatterns5-dev
libqt5svg5-dev
qtwebengine5-dev
qtscript5-dev
libqt5x11extras5-dev
qtbase5-private-dev
qtpositioning5-dev

Greg

1 Like