Skip to content

Qt compilation

Olivier Michel edited this page Sep 20, 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.13.1 with QtWebEngine

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

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

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

- Qt
| - Qt 5.13.1
| | - 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.13/5.13.1/submodules/qtbase-everywhere-src-5.13.1.tar.xz
tar xf qtbase-everywhere-src-5.13.1.tar.xz
rm qtbase-everywhere-src-5.13.1.tar.xz
cd qtbase-everywhere-src-5.13.1
./configure -release -opensource -dbus -disable-eglfs -nomake tools -nomake examples -nomake tests -icu -qt-xcb -system-libjpeg
make
cp plugins/imageformats/libqjpeg.so ~/Qt5.13.1/5.13.1/gcc_64/plugins/imageformats

Patch and Recompile QWebSockets

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

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