Skip to content

Qt compilation

Olivier Michel edited this page Sep 19, 2019 · 21 revisions

This page explains how to recompile the Qt dependency on every platforms.

Windows

On Windows, Qt is provided as a MSYS2 pacman package and is automatically installed when installing the msys dependencies.

Linux

Download and Install Qt 5.11.2 with QtWebEngine

Download http://download.qt.io/official_releases/qt/5.11/5.11.2/qt-opensource-linux-x64-5.11.2.run and run it:

wget http://download.qt.io/official_releases/qt/5.11/5.11.2/qt-opensource-linux-x64-5.11.2.run
chmod +x ./qt-opensource-linux-x64-5.11.2.run
./qt-opensource-linux-x64-5.11.2.run

Install Qt in $(HOME)/Qt5.11.2(default directory) with at least these items selected:

- Qt
| - Qt 5.11.2
| | - Desktop gcc 64-bit
| | - Qt WebEngine

Install and Create the Precompiled Package

cd ~/webots/src/install_scripts
./qt_linux_installer.sh

Optional Modules Recompilation

These are optional recompilation of some Qt modules to improve performance or fix temporary bugs. In order to recompile these modules, the following packages need to be installed:

sudo apt-get update
sudo apt-get install libdbus-1-dev libglu1-mesa-dev libegl1-mesa-dev libx11-xcb-dev libfreetype6-dev libcups2-dev gperf libnss3-dev libxcomposite-dev libxcursor-dev libxi-dev libxtst-dev bison flex libxrandr-dev libxkbcommon-x11-dev

Compile libqjpeg with System libjpeg

Recompiling the liqjpeg plugin will faster JPEG compression:

cd ~/Downloads
wget https://download.qt.io/official_releases/qt/5.11/5.11.2/submodules/qtbase-everywhere-src-5.11.2.tar.xz
tar xf qtbase-everywhere-src-5.11.2.tar.xz
rm qtbase-everywhere-src-5.11.2.tar.xz
cd qtbase-everywhere-src-5.11.2
./configure -release -opensource -dbus -disable-eglfs -nomake tools -nomake examples -nomake tests -icu -qt-xcb -system-libjpeg
make
cp plugins/imageformats/libqjpeg.so ~/Qt5.11.2/5.11.2/gcc_64/plugins/imageformats

Patch and Recompile QWebSockets

QWebSockets 5.11.2 (and earlier) has a bug which breaks SSL connections from Firefox and Edge: https://bugreports.qt.io/browse/QTBUG-57665. To fix it, we need to patch and recompile the Qt websocket library.

Download the qtwebsockets module:

cd ~/Downloads
wget https://download.qt.io/official_releases/qt/5.11/5.11.2/submodules/qtwebsockets-everywhere-src-5.11.2.tar.xz
tar xf qtwebsockets-everywhere-src-5.11.2.tar.xz
rm qtwebsockets-everywhere-src-5.11.2.tar.xz
cd qtwebsockets-everywhere-src-5.11.2
# apply this patch: https://codereview.qt-project.org/#/c/180148/4//ALL,unified
export QT5DIR=~/Qt5.11.2/5.11.2/gcc_64
export PATH=$QT5DIR/bin:$PATH
qmake
make
make install

Patch and Recompile QtWebEngine

Chromium included in QtWebEngine 5.11.2 prints some warnings in the terminal (https://bugreports.qt.io/browse/QTBUG-68547). To fix it, we need to patch and recompile the QtWebEngine library:

cd ~/Downloads
wget https://download.qt.io/official_releases/qt/5.11/5.11.2/submodules/qtwebengine-everywhere-src-5.11.2.tar.xz
tar xf qtwebengine-everywhere-src-5.11.2.tar.xz
rm xf qtwebengine-everywhere-src-5.11.2.tar.xz
cd qtwebengine-everywhere-src-5.11.2
# manually apply patch from https://codereview.qt-project.org/#/c/196513/2 to 'src/3rdparty/chromium/base/debug/stack_trace_posix.cc'
export QT5DIR=~/Qt5.11.2/5.11.2/gcc_64
export PATH=$QT5DIR/bin:$PATH
qmake
make
make install

In order to avoid using system libwebp* libraries available on the system and that won't be compatible from the libraries on Ubuntu 18.04, it is better to uninstall libwep5 before configuring and compiling the QtWebEngine module.

Sample Configure Setting to Compile Qt from Sources

./configure -release -opensource -dbus -nomake examples -nomake tests -icu -qt-xcb -cups -system-libjpeg

Mac

Install Qt 5.11.2 with QWebEngine

Download https://download.qt.io/official_releases/qt/5.11/5.11.2/qt-opensource-mac-x64-5.11.2.dmg and install it in $(HOME)/Qt5.11.2 (default directory) with at least these items selected:

- Qt 5.11.2
| - Qt 5.11.2
| | - macOS
| | - Qt WebEngine

Install in Webots and make installation package

cd ~/webots/src/install_scripts/
# Optional: edit the 2 first paths of ./qt_mac_installer.sh
./qt_mac_installer.sh
Clone this wiki locally