Skip to content

Qt compilation

David Mansolino edited this page Jun 11, 2020 · 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

Qt 5.15.0 Pre-compiled binaries

Download and Install Qt 5.15.0 binaries including QtWebEngine

Download https://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run and run it:

wget https://download.qt.io/official_releases/online_installers/qt-unified-linux-x64-online.run
chmod +x ./qt-unified-linux-x64-online.run
./qt-unified-linux-x64-online.run

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

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

Modules Recompilation

We should recompile 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.15/5.15.0/submodules/qtbase-everywhere-src-5.15.0.tar.xz
tar xf qtbase-everywhere-src-5.15.0.tar.xz
rm qtbase-everywhere-src-5.15.0.tar.xz
cd qtbase-everywhere-src-5.15.0
./configure -release -opensource -dbus -disable-eglfs -nomake tools -nomake examples -nomake tests -icu -system-libjpeg
make
cp plugins/imageformats/libqjpeg.so ~/Qt5.15.0/5.15.0/gcc_64/plugins/imageformats

Patch and Recompile QWebSockets

QWebSockets 5.15.0 (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.15/5.15.0/submodules/qtwebsockets-everywhere-src-5.15.0.tar.xz
tar xf qtwebsockets-everywhere-src-5.15.0.tar.xz
rm qtwebsockets-everywhere-src-5.15.0.tar.xz
cd qtwebsockets-everywhere-src-5.15.0
# apply this patch: https://codereview.qt-project.org/#/c/180148/4//ALL,unified
export QT5DIR=~/Qt5.15.0/5.15.0/gcc_64
export PATH=$QT5DIR/bin:$PATH
qmake
make
make install

Install and Create the Qt Package for Webots

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

Sample Configure Setting to Compile Qt from the Sources

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

Mac

Install Qt 5.15.0 with QWebEngine

Download Qt 5.15.0 for macOS (https://www.qt.io/download) and install it in $(HOME)/Qt5.15.0 (default directory) with at least these items selected:

- Qt 5.15.0
| - Qt 5.15.0
| | - 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