# Building Slicer with gcc 6

**URL:** https://discourse.slicer.org/t/building-slicer-with-gcc-6/1422
**Category:** Support
**Created:** [November 9, 2017, 3:38pm UTC](https://discourse.slicer.org/t/building-slicer-with-gcc-6/1422 "2017-11-09T15:38:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![franklinwk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/franklinwk/32/862_2.png) [@franklinwk](https://discourse.slicer.org/u/franklinwk)
#### Post date: [November 9, 2017, 3:38pm UTC](https://discourse.slicer.org/t/building-slicer-with-gcc-6/1422/1 "2017-11-09T15:38:47Z")

</div>

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](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

---

<div class="post-metadata">

### Author: ![gcsharp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gcsharp/32/863_2.png) [@gcsharp](https://discourse.slicer.org/u/gcsharp)
#### Post date: [November 9, 2017, 4:41pm UTC](https://discourse.slicer.org/t/building-slicer-with-gcc-6/1422/2 "2017-11-09T16:41:13Z")

</div>

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:

```auto
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:

```auto
    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:

```auto
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

---

<div class="post-metadata">

### Author: ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)
#### Post date: [November 9, 2017, 5:04pm UTC](https://discourse.slicer.org/t/building-slicer-with-gcc-6/1422/3 "2017-11-09T17:04:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![franklinwk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/franklinwk/32/862_2.png) [@franklinwk](https://discourse.slicer.org/u/franklinwk)
#### Post date: [November 9, 2017, 5:43pm UTC](https://discourse.slicer.org/t/building-slicer-with-gcc-6/1422/4 "2017-11-09T17:43:12Z")

</div>

Hi Greg,

Thanks, I’ll try that out! Did you use Qt5 built from source (and if so via JC’s [easy build](https://github.com/jcfr/qt-easy-build/tree/5.9.1#readme)?) or another package?

---

<div class="post-metadata">

### Author: ![gcsharp](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/gcsharp/32/863_2.png) [@gcsharp](https://discourse.slicer.org/u/gcsharp)
#### Post date: [November 9, 2017, 6:19pm UTC](https://discourse.slicer.org/t/building-slicer-with-gcc-6/1422/5 "2017-11-09T18:19:05Z")

</div>

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
