Building slicer with system QT

Hi,
I’m trying to compile slicer for the first time - but when I try to compile QT webkit I get an error: conflicting declaration ‘typedef int32_t UChar32’
In manual I found information that I can use qt from system package, but when i try to compile it using:
$CMAKE_BIN -DCMAKE_BUILD_TYPE:STRING=Release -DQT_QMAKE_EXECUTABLE:FILEPATH=/usr/bin/qmake-qt4 …/Slicer-Source/Slicer
I got an “missing QTOPENGL” error.
I was searching in the Internet but I wasn’t able to find solution. Could anybody give me any advise/clue? Its third day and I made no progress in compilig it…

Hi Sylwia,

You’re using Linux? I had issues in Ubuntu/Pop_OS. You could try following the steps that I took and see if they help:

Note that I built Qt5 using the qt-easy-build scripts, I did not try to use a system install of Qt.

Thomas

Slicer developers recommend building against Qt5.

On my host running Arch Linux, the following configuration builds nicely :

cmake -DSlicer_VTK_VERSION_MAJOR:INT=9 -DQt5_DIR:PATH=/usr/lib/cmake/Qt5 -DSlicer_USE_PYTHONQT_WITH_OPENSSL:BOOL=0 -DBUILD_TESTING:BOOL=0 -DCMAKE_BUILD_TYPE:STRING=Release …/Slicer

You should adapt Qt5_DIR parameter to your distribution.

If you really want Qt4, I guess you’ll be having a hard time and few help. In any case, Qt4 support is scheduled to be deprecated, as far as I understood.

Ok, thanks :slight_smile: I’ll try to build it with Qt5 :slight_smile:

1 Like

Ok, I tried to compile slicer with Qt5. (I’m using linux mint).
Configuration that I’m using to compile Slicer:

$CMAKE_BIN -DQT_QMAKE_EXECUTABLE:FILEPATH=/home/software/medical/slicer/Slicer-Build-Support/qt-everywhere-build-5.10.0/bin/qmake -DQt5_DIR=/home/software/medical/slicer/Slicer-Build-Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_PREFIX_PATH:PATH=/home/software/medical/slicer/Slicer-Build-Support/qt-everywhere-build-5.10.0/bin/ -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF -DSlicer_USE_SimpleITK:BOOL=OFF -DSlicer_USE_QtTesting:BOOL=OFF -DSlicer_VTK_VERSION_MAJOR:STRING=9 -DSlicer_VTK_RENDERING_BACKEND:STRING=OpenGL2 -DSlicer_BUILD_DataStore:BOOL=OFF …/Slicer-Source/Slicer/

But I get an error:

Call Stack (most recent call first):
CMake/SlicerBlockFindQtAndCheckVersion.cmake:36 (find_package)
CMake/SlicerBlockFindQtAndCheckVersion.cmake:110 (__SlicerBlockFindQtAndCheckVersion_find_qt)
CMakeLists.txt:607 (include)

CMake Warning at CMake/SlicerBlockFindQtAndCheckVersion.cmake:36 (find_package):
Found package configuration file:

/home/software/medical/slicer/Slicer-Build-Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5/Qt5Config.cmake

but it set Qt5_FOUND to FALSE so package “Qt5” is considered to be NOT
FOUND. Reason given by package:

Failed to find Qt5 component “WebEngine” config file at
“/home/software/medical/slicer/Slicer-Build-Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5WebEngine/Qt5WebEngineConfig.cmake”

Failed to find Qt5 component “WebEngineWidgets” config file at
“/home/software/medical/slicer/Slicer-Build-Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5WebEngineWidgets/Qt5WebEngineWidgetsConfig.cmake”

Try installing libqt5webengine5 and probably qt5webengine-dev. I think Slicer requires at least Qt 5.7 (note the qt-easy-build script mentioned by tavaughan may be easier if the distribution version is too old).

How? By apt-get? Those packages does not exist.
I’m installing qt5 using easy-build, but it does not compile web engine

You need to install all of the dependencies listed here. I built Qt 5.10 recently on Ubuntu 16.04 starting from those instructions. I don’t remember if they were complete, but here are all the packages I installed to be able to compile.

Unfortunately WebEngine is rather tricky to compile because the build system is layered in such a way that it does not give very good feedback during configuration about why webengine was skipped.

Ok, I’m returning to this old topic… Previously I managed to install Slicer with older version of Qt, but as I reinstalled my system and had to install Slicer again I decided to make it with Qt5.
I’ve stuck again in this webengine installation… But when I tried to complie webkit separatelly I have a message:

“A suitable version of dbus could not be found.
QtWebEngine will not be built.”

Anyone know which is this ‘suitable version’ of dbus and how to install it?
When I’m makind apt-get dbus I receive message that dbus is already installed
System: linux mint 19 Tara,
Qt: using easy build script, so it is 5.10.0

You should still be able to build Slicer with Qt4. We’ll probably remove Slicer’s QtWebEngine dependency shortly after releasing Slicer-4.10.

So, a solution can be to keep using Qt4 for now and switch to Qt5 when QtWebEngine is not needed for Slicer anymore (probably within a few months).

Well I’m kind of stubborn person, and I’m irritated when I don’t know how to do something, so I would prefer to manage compile Slicer with Qt5 :wink:

If you build against Qt5, do not pass QT_QMAKE_EXECUTABLE, only Qt5_DIR.

Yes, but first I have to compile this version of Qt. When I try to compile qt4 on new linux distribution I get compilation errors. And when I try to compile qt5 I cannot compile webengine - some missing dependency probably, but I don’t know which dependency :frowning:

To clarify, in you first message, you indicated that the command:

failed with

Failed to find Qt5 component “WebEngine” config file at
“/home/software/medical/slicer/Slicer-Build-Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5WebEngine/Qt5WebEngineConfig.cmake”

Failed to find Qt5 component “WebEngineWidgets” config file at
“/home/software/medical/slicer/Slicer-Build-Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5WebEngineWidgets/Qt5WebEngineWidgetsConfig.cmake”

could you instead try the following:

$CMAKE_BIN \
  -DQt5_DIR=/home/software/medical/slicer/Slicer-Build-Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5   \
  -DCMAKE_BUILD_TYPE:STRING=Release \
  -DSlicer_USE_PYTHONQT_WITH_TCL:BOOL=OFF \
  -DSlicer_USE_SimpleITK:BOOL=OFF \
  -DSlicer_USE_QtTesting:BOOL=OFF \
  -DSlicer_BUILD_DataStore:BOOL=OFF \
  ../Slicer-Source/Slicer/
  • The argument QT_QMAKE_EXECUTABLE should NOT be specified along with Qt5_DIR
  • The argument CMAKE_PREFIX_PATH is not needed, the recommended way are to pass Qt5_DIR or QT_QMAKE_EXECUTABLE
  • Passing Slicer_VTK_RENDERING_BACKEND or Slicer_VTK_VERSION_MAJOR are not needed, these will be automatically set based on Qt5_DIR or QT_QMAKE_EXECUTABLE
  • Finally, make sure to run the configure command in a clean build directory

Last, could you also check that Qt5WebEngineConfig.cmake exists in your install of Qt5, if not make sure you select the corresponding component during installation. For example, see selected components here.