How to build and extend Qt 6.6 base install with various extra features from Qt sub-modules for custom needs.
Building Qt 6.6 submodules
Qt submodules contains various extra features not included in the base package (qtbase), for example QtQuick (qtdeclarative), support for Wayland (qtwayland), CAN-BUS (qtserialbus) and so forth.
For most parts, building any of the Qt submodules is quite straightforward:
- download the sources for the submodules you require
- extract the archive
tar xf submodule-version.tar.xz
- Install any required dependencies
- Install any optional dependencies
- Optional: create a build directory and configure the build inside it
- Configure sources
/opt/Qt/6.6.3/bin/qt-configure-module .
- Build the sources
cmake --build . --parallel 4
- Install the result
cmake --install .
Some submodules have optional features or supports various backends. To get a list of these, run qt-configure-module --help
The only thing you need to keep in mind is to build them in the correct order to satisfy various dependencies. The following (incomplete at this time) table describes the required dependency submodules and any development packages that are needed and also the build time on various systems.
Build time on various systems | ||||||||
---|---|---|---|---|---|---|---|---|
Module | Required submodules | Development packages required | Description | Pi 5 | Pi 4 | Pine 64 | Pi 3 | AMD Ryzen 3600X |
qtbase | See Qt 6.6 Base tutorial | Qt core, start with this. | ~40m | ~50m | ~3h | ~6m | ||
qtimageformats | qtbase | libmng-dev | Support for loading various extra image formats TIFF, MNG, WebP | ~13s | ||||
qtsvg | qtbase | Support for SVG vector graphics | ~30s | |||||
qtshadertools | qtbase | Tools for the cross-platform Qt shader pipeline | ~2m | ~12m | ||||
qttools | qtbase qtdeclarative | QDoc requires clang to be installed (See section about documentation above): clang-11 libclang-11-dev libclang-common-11-dev | Various Qt tools:
| ~12m | ||||
qtserialbus | qtbase | Serial bus (CAN bus, ModBus) support | ~1m | ~2m | ||||
qtserialport | qtbase qtserialbus | Serial port support | ~7s | < 1m | ||||
qtlocation | qtbase qtserialport | Positioning (GPS) and location (Map) services | < 3m | |||||
qtdeclarative | qtshadertools | Qt Quick / QML | ~48m | ~85m | ~6m | |||
qttimeline | qtbase qtdeclarative | ~18s | ||||||
qtpositioning | qtbase qtdeclarative | ~1m 20s | ||||||
qtlocation | ~3m 20s | |||||||
qtmultimedia | qtbase qtdeclarative qt3d | For ffmpeg backend: (prefered backend since 6.5.0): Note: ffmpeg backend requires pulseaudio support to be installed, see below. For gstreamer backend: For pulseaudio support: For ALSA support: | Multimedia (audio/video) support
Qt3D is required for support for spatial audio | ~4m 30s | ||||
qt3d | qtbase | Qt 3D provides functionality for near-realtime simulation systems with support for 2D and 3D rendering in both Qt C++ and Qt Quick applications. | ~16m | |||||
qtquick3d | qtbase | A high-level API for creating 3D content and 3D user interfaces based on Qt Quick | ~13m 30s | |||||
qtquick3dphysics | qtbase | A physics engine for use with Qt Quick 3D | ||||||
qtdatavis3d | qtbase qtdeclarative | ~2m 20s | ||||||
qtsensors | qtbase qtmultimedia qtdeclarative | Support for various device sensors | ~1m 10s | |||||
qtnetworkauth | qtbase | Network authentication protocol support (OAuth) | ~13s | < 1m | ||||
qtconnectivity | qtbase | bluez libbluetooth-dev | Bluetooth and NFC connectivity support | ~2m 30s | ||||
qtwebsockets | qtbase qtdeclarative | Websockets support | ~30s | ~1m | ||||
qtwebchannel | qtbase qtwebsockets | Enabled peer-to-peer communication between a server (QML/C++ application) and a client (HTML/JavaScript or QML application) | ||||||
qtcharts | qtbase qtdeclarative | Charting controls | ~6m | ~10m | ||||
qtwayland | qtbase | libwayland-dev | Wayland support | ~5m 20s | ~10m | |||
qtvirtualkeyboard | qtbase qtsvg | Provides input framework and reference implementation for virtual on-screen keyboard. | ~3m 30s | ~4m | ||||
qtwebengine | qtbase qtdeclarative | flex bison gperf libre2-dev libnss3-dev nodejs libdrm-dev libxdamage-dev libsnappy-dev | WebEngine. | N/A | ||||
qtscxml | ~1m 30s | |||||||
qtgrpc | qtbase | Support for gRPC | ||||||
qthttpserver | qtbase | Qt HTTP Server | ||||||
qtspeech | qtbase | Text To Speech with various backends | ||||||
qt5compat | qtbase | Unsupported Qt 5 compatibility code. | ~1m | ~2m |
A note about Qt submodules only in git
Some Qt submodules are not available directly as downloadable release archives, but instead are just branched/tagged in the Qt git repository. For example qtmqtt for MQTT support and qtcoap for COAP support are some of such modules. These sub-modules can all be found in the Qt git repository.
To download, for example qtmqtt, for Qt 6.6.1 you can clone the repository with:
git clone -b v6.6.1
git://code.qt.io/qt/qtmqtt.git
The configuring, compiling and installing parts goes as any other sub-module.
TL;DR Building submodules
You can quickly configure, build and install the Qt submodules with (why not do it in simple bash for loop, I'll leave that as an exercise for the reader!):
/opt/Qt/6.6/bin/qt-configure-module . && cmake --build . --parallel 4 && cmake --install .