Compile errors Pop!_OS/Ubuntu with Qt 5.10

It looks like you are picking up a system Qt installation.

Hi Thomas,

I have no issue in compiling in ubuntu 17.10. I don’t know the reason of your error, but I can share my configuration (it may help):

  1. I compile with gcc 6.4.0
  2. I used Qt5.10 compiled with the Jc’s qt-easy-build script.
  3. this is the string that I used to configure Slicer:
    cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DQt5_DIR=/home/davide/Slicer/Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5 …/Slicer

In general I noticed that if you miss -DQt5_DIR variable (and you setup the Qt5 paths later on, e.g. in ccmake), you can have issue.
I hope helps

ah yes, I didn’t noticed the paths. Thomas, most likely you need to setup the Qt5 varibale in the cmake

Hi Thomas,

Why should you try to build it on Ubuntu. I just unpacked the tar-file and the I could run Slicer rightaway just from the slicer-file in the folder. Created a extra quicklauncher in the menu.
Done!

p.s. I use LinuxMint (ubuntubased)

Greetings
Léon

Thank you Davide and Isaiah,

Good catch. I’m not sure why it would be picking up a system installation. I am running Slicer build with:

cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DQt5_DIR:Path=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5 …/S4
make

This should work, no?

yes, hopefully (:slight_smile: .
(however, I don’t use the :Path in front of the Qt5_DIR variable)

P.S.: you can also use the -j option with make to speed up.
e.g.: make -j 8

Thanks. :slight_smile: I usually use -j flag, I didn’t use it this time because I want to see the output one line at a time before the build stops.

To be clear, the issue is that I’m running this command:

cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DQt5_DIR:Path=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5 …/S4

Then make, and the build fails.

Correction: I’m not sure why I wrote Ubuntu 17.10 in the title. I’m actually running Pop!_OS. I think it’s based on Ubuntu 17.10, but it might not be the exact same thing. I’ll correct the title.

have you cleaned the previous build?

Yes. I deleted everything in the Slicer build directory and ran these commands again to be 100% sure:

cd S4D
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DQt5_DIR=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5 …/S4
make -j7

I got the same result.

All the Qt definitions I see in ccmake refer to my Qt build (in /media/vaughan/workspace/lnx/devel/Support/). So I’m not sure what’s going on… whether it’s a configuration problem or something gone weird when I built Qt5. As far as I can tell I haven’t deviated from the usual process.

In case it’s relevant here are the versions of various packages/builds I’m using:

sorry no idea, I had not these path issues. Here are my building differences:

gcc 6.4
cmake 3.9.1 from ubuntu repository

These kind of issues seems to be due to ldd picking up system Qt. See for example https://stackoverflow.com/questions/36128645/error-on-execution-version-qt-5-not-found-required-by.

You can find build script that Slicer nightly builds use here: https://github.com/Slicer/DashboardScripts

Thanks @lassoan :pray: !

I’m not sure where I am supposed to find the build script in the second link you sent. But the links still helped. I can get Slicer to compile now. I ran the following:

cd S4D
export LD_LIBRARY_PATH=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/lib
export PKG_CONFIG_PATH=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/lib/pkgconfig
export PATH=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/bin:$PATH
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DQt5_DIR=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5 …/S4

And the rest of the build was ok. :+1: Edit: Though inconvenience that I have to export the LD_LIBRARY_PATH to run Slicer from Terminal.

Normally setting the Qt5_DIR in CMake should be enough though… no?

Edit again: I’m going to try setting the path variable similar to here.

in my experience, yes

From the first message, it seems like the problem is higher, at the Qt build level: the uic program is linked against system Qt libraries rather than against the libraries in its build tree:

/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/bin/uic: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.10’ not found (required by /media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/bin/uic)

So the problem is potentially with Qt or the qt-easy-build discovery process rather than Slicer per se. (but the only thing I can think of is maybe you have LD_LIBRARY_PATH set already, for a Nix or multi-arch configuration? then ld might defer to those during build as in the link from Andras).

@tavaughan I just upgraded to ubuntu 18.04 (completely clean installation) and I had the same issue.

Config:

  • GCC 7.3.0
  • cmake 3.10.2
  • git 2.17
  • qt from Jc’s script

If I have time I’ll try to donwgrade gcc and see if the linker will work properly.
Setting manually the paths fix the issue as well.

@Davide_Punzo @tavaughan when you build with qt-easy-build, do you get QtWebEngine? Did you install anything other than the Slicer prerequisites?

I’ve built on two different systems, and didn’t get QtWebEngine either time. From this list it seems I was missing bison, flex, and gperf (at least)… trying again after installing.

@ihnorton, I had the same issue. I ended up with this post https://www.ics.com/blog/how-compile-qt-source-code-linux. For ubutnu 18.04 I had to change a couple of libraries, but then worked.

In addition, I noticed that I had to do a clean installation to get to compile the webengine (i.e., this workflow was not working: tried to compile, error, installing additional libraries, trying again to compile). It looked like the configuration script was not really looking again.

P.S.: at a cetain point the script print out the configuration building. This is mine after installing all the libraries in the post (and maybe few others) and doing again a clean building of Qt:

Configure summary:

Build type: linux-g++ (x86_64, CPU features: mmx sse sse2)
Configuration: use_gold_linker sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c largefile precompile_header rdrnd shani silent shared release c++11 concurrent dbus reduce_exports reduce_relocations stl
Build options:
Mode … release
Optimize release build for size … no
Building shared libraries … yes
Using C++ standard … C++11
Using ccache … no
Using gold linker … yes
Using new DTAGS … yes
Using precompiled headers … yes
Using LTCG … no
Target compiler supports:
SSE … SSE2 SSE3 SSSE3 SSE4.1 SSE4.2
AVX … AVX AVX2
AVX512 … F ER CD PF DQ BW VL IFMA VBMI
Other x86 … AES F16C RDRAND SHA
Build parts … libs tools
Qt modules and options:
Qt Concurrent … yes
Qt D-Bus … yes
Qt D-Bus directly linked to libdbus … yes
Qt Gui … yes
Qt Network … yes
Qt Sql … yes
Qt Testlib … yes
Qt Widgets … yes
Qt Xml … yes
Support enabled for:
Using pkg-config … yes
QML debugging … yes
udev … yes
Using system zlib … yes
Qt Core:
DoubleConversion … yes
Using system DoubleConversion … no
GLib … yes
iconv … no
ICU … yes
Logging backends:
journald … no
syslog … no
slog2 … no
Using system PCRE2 … no
Qt Network:
getifaddrs() … yes
IPv6 ifname … yes
libproxy … no
OpenSSL … yes
Qt directly linked to OpenSSL … no
SCTP … no
Use system proxies … yes
Qt Gui:
Accessibility … yes
FreeType … yes
Using system FreeType … yes
HarfBuzz … yes
Using system HarfBuzz … yes
Fontconfig … yes
Image formats:
GIF … yes
ICO … yes
JPEG … yes
Using system libjpeg … yes
PNG … yes
Using system libpng … yes
EGL … yes
OpenVG … no
OpenGL:
Desktop OpenGL … yes
OpenGL ES 2.0 … no
OpenGL ES 3.0 … no
OpenGL ES 3.1 … no
OpenGL ES 3.2 … no
Vulkan … no
Session Management … yes
Features used by QPA backends:
evdev … yes
libinput … no
INTEGRITY HID … no
mtdev … no
tslib … no
xkbcommon-evdev … no
QPA backends:
DirectFB … no
EGLFS … yes
EGLFS details:
EGLFS i.Mx6 … no
EGLFS i.Mx6 Wayland … no
EGLFS EGLDevice … yes
EGLFS GBM … no
EGLFS Mali … no
EGLFS Raspberry Pi … no
EGL on X11 … yes
LinuxFB … yes
VNC … yes
Mir client … no
X11:
Using system-provided XCB libraries … yes
EGL on X11 … yes
Xinput2 … yes
XCB XKB … yes
XLib … yes
XCB render … yes
XCB GLX … yes
XCB Xlib … yes
Using system-provided xkbcommon … no
Native painting (experimental) … yes
Qt Widgets:
GTK+ … no
Styles … Fusion Windows
Qt PrintSupport:
CUPS … yes
Qt Sql:
DB2 (IBM) … no
InterBase … no
MySql … no
OCI (Oracle) … no
ODBC … no
PostgreSQL … no
SQLite2 … no
SQLite … yes
Using system provided SQLite … no
TDS (Sybase) … no
Qt SerialBus:
Socket CAN … yes
Socket CAN FD … yes
QtXmlPatterns:
XML schema support … yes
Qt QML:
QML interpreter … yes
QML network support … yes
Qt Quick:
Direct3D 12 … no
AnimatedImage item … yes
Canvas item … yes
Support for Qt Quick Designer … yes
Flipable item … yes
GridView item … yes
ListView item … yes
Path support … yes
PathView item … yes
Positioner items … yes
ShaderEffect item … yes
Sprite item … yes
Qt Gamepad:
SDL2 … no
Qt 3D:
Assimp … yes
System Assimp … no
Output Qt3D Job traces … no
Output Qt3D GL traces … no
Use SSE2 instructions … yes
Use AVX2 instructions … no
Aspects:
Render aspect … yes
Input aspect … yes
Logic aspect … yes
Animation aspect … yes
Extras aspect … yes
Qt 3D GeometryLoaders:
Autodesk FBX … no
Qt Wayland Drivers:
EGL … yes
Raspberry Pi … no
XComposite EGL … yes
XComposite GLX … yes
DRM EGL … yes
libhybris EGL … no
Qt Wayland Client … yes
Qt Wayland Compositor … yes
Qt Bluetooth:
BlueZ … no
BlueZ Low Energy … no
Linux Crypto API … no
WinRT Bluetooth API (desktop & UWP) … no
Qt Sensors:
sensorfw … no
Qt Quick Controls 2:
Styles … Default Fusion Imagine Material Universal
Qt Quick Templates 2:
Hover support … yes
Multi-touch support … yes
Qt Positioning:
Gypsy GPS Daemon … no
WinRT Geolocation API … no
Qt Location:
Geoservice plugins:
OpenStreetMap … yes
HERE … yes
Esri … yes
Mapbox … yes
MapboxGL … no
Itemsoverlay … yes
Qt Multimedia:
ALSA … yes
GStreamer 1.0 … yes
GStreamer 0.10 … no
Video for Linux … yes
OpenAL … no
PulseAudio … yes
Resource Policy (libresourceqt5) … no
Windows Audio Services … no
DirectShow … no
Windows Media Foundation … no
Qt WebEngine:
Embedded build … no
Pepper Plugins … yes
Printing and PDF … yes
Proprietary Codecs … no
Spellchecker … yes
Native Spellchecker … no
WebRTC … yes
Use System Ninja … yes
Geolocation … yes
Use ALSA … yes
Use PulseAudio … yes
Optional system libraries used:
re2 … no
icu … no
libwebp, libwebpmux and libwebpdemux . yes
opus … yes
ffmpeg … no
libvpx … no
snappy … no
libsrtp … no
glib … yes
zlib … yes
minizip … yes
libevent … yes
jsoncpp … yes
protobuf … no
libxml2 and libxslt … yes
lcms2 … no
png … yes
harfbuzz … yes
Required system libraries:
fontconfig … yes
dbus … yes
nss … yes
khr … yes
glibc … yes
Required system libraries for qpa-xcb:
libdrm … yes
xcomposite … yes
xcursor … yes
xi … yes
xrandr … yes
xtst … yes

1 Like

I guess that for Webengine these are the important ones:

Thanks. The set of dependencies from the ICS link seems to have done it. Now I get a listing for WebEngine in the configure output. Unfortunately as far as I can tell there is no way to make ./configure fail fast if webengine won’t be built (https://github.com/jcfr/qt-easy-build/issues/40).

I now have Slicer building and running without fiddling with LD_LIBRARY_PATH. I think the issue was with the Build-qt.sh script.

Steps:

  1. Install Qt dependencies (for QtWebEngine-specific dependencies I referred to this page https://wiki.qt.io/QtWebEngine/How_to_Try )
  2. Download the Qt-build script as per https://github.com/jcfr/qt-easy-build/tree/5.10.0#readme
  3. Open the script in a text editor. Scroll to the configure step near the end of the file (line 365 at time of writing). Change the -no-rpath option to -rpath. I changed:

./configure $qt_install_dir_options
[stuff]
-no-rpath \

to:

./configure $qt_install_dir_options
[stuff]
-rpath \

Note: I suspect simply removing the -rpath line would have the same result as removing it completely. I am not 100% sure of this though.

  1. Run the Qt-build script. It takes a while so I just left it overnight.
  2. Download and install Slicer dependencies as indicated on build instructions page: https://www.slicer.org/wiki/Documentation/Nightly/Developers/Build_Instructions#Ubuntu
  3. Download Slicer source files.
  4. Create a script that has contents like the following:

cd S4D
cmake
-DQT_QMAKE_EXECUTABLE:FILEPATH=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/bin/qmake
-DQt5_DIR=/media/vaughan/workspace/lnx/devel/Support/qt-everywhere-build-5.10.0/lib/cmake/Qt5
-DCMAKE_BUILD_TYPE:STRING=Debug
-DCMAKE_PREFIX_PATH:PATH=/media/vaughan/workspace/lnx/devel/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
…/S4
make -j7

Make sure to set your Qt directories to wherever you built it.

  1. Run script. Like Qt, this will take a while.

With any luck, Slicer should build correctly. After doing these steps I do not need to run any export LD_LIBRARY_PATH commands.

I created an issue on GitHub for discussion: https://github.com/jcfr/qt-easy-build/issues/42