Building the QtWebEngine Qt module takes a lot of time, space and memory. It is highly recommended to build qtwebengine separately from base Qt 5.
With the 4GB or 8GB Raspberry Pi 4 it is fully possible to build, but you might still need to enable swap and also limit the amount of parallel builds the ninja build tool (that qtwebengine uses internally for building) is allowed to use.
Start by first building the base Qt 5 framework you need (You can follow the guide for Qt 5.12 or Qt 5.15) and make sure it works ok. Then you can build the qtwebengine module. The examples below will be using Qt version 5.15.2 so if you are using any other version, just adjust the paths to correspond to the version of Qt that you are using.
Download the sources for QtWebEngine
You have two choices here, either download the the release archives or use qtwebengine from git.
The archives are easier and take less space but unfortunately getting old. Git repositories takes up more space and needs a bit more work.
a) Download release archive
b) Use git repository
git clone https://invent.kde.org/qt/qt/qtwebengine.git git checkout -t remotes/origin/5.15.4 git submodule update --init
Install required and any optional build dependencies
|Required||flex bison gperf libre2-dev libnss3-dev nodejs||
These tools and libraries are required for any build.
git version requires nodejs
|Required for X11 support||libdrm-dev libxdamage-dev||If you need qpa-xcb/X11 support you need these|
|Optional||libxml2-dev libxslt1-dev libminizip-dev libjsoncpp-dev liblcms2-dev libevent-dev libprotobuf-dev protobuf-compiler libwebp-dev libpoppler-cpp-dev||These are optional but can be nice to have for additional support|
|Optional system build tools||ninja-build re2c||You can speed up the build by using system ninja build tool, otherwise it will be built first.|
|Optional but unusable versions in raspbian||libopus-dev libvpx-dev||These would add support for opus and vpx media, but unfortunately the versions available in Raspberry Pi OS/Raspbian buster are too old.|
Setup sources for building
Extract the source archive and create a separate build directory.
Disable jumbo build in 5.15
We had no luck with the default jumbo build system in 5.15, compiling failed with obscure errors that made no sense, so we disable it.
Adjust the parameter with help of sed with the command (adjust path!) or use your favorite editor to change the option:
sed -i -e 's|use_jumbo_build=true|use_jumbo_build=false|' ../qtwebengine-everywhere-src-5.15.2/src/buildtools/config/common.pri
Configure QtWebEngine for building
/opt/Qt/5.15.2/bin/qmake ../qtwebengine-everywhere-src-5.15.2 -- -no-webengine-geolocation
If all goes well, you should be presented with a summary that looks similar to this (Yours does not need to match 100% as it depends on what packages you have installed and on any options given):
- Example configuration summary for QtWebEngine 5.12.10
- Example configuration summary for QtWebEngine 5.15.2 (TBA)
All is well as long as the configuration does not give errors. Just make sure that any extra features you might need are found and enabled.
Now if everything is properly detected (and no mention about QtWebEngine not being built), proceed to building. We need to limit the amount of parallel builds, especially on anything less than 8GB, by limiting ninja parallel builds with NINJAJOBS equaly to 4 or less.
Invoke make with:
make -j4 NINJAJOBS=-j4
Building will take a very long time.
When (and if) the build is complete, the installation part is easy, just:
And you are done.
Possible build issues
The following table has collected some of the problems and build issues found with QtWebEngine
|QtWebEngine version||Problem description||Details, Solution or workaround|
Internal Compiler Error, gcc 8.3.0
internal compiler error: in convert_move, at expr.c:218 static void exec_ops(const Op* ops, const void** args,
a) Use ARMv7 build of Qt
b) Patch the source to disable optimization with a gcc pragma in source:
#pragma GCC optimize ("O0")
|5.15.2||fatal error: xcb/dri3.h: No such file or directory||
Missing required development package that configure scripts does not check for.
qtwebengine-everywhere-src-5.15.2/src/3rdparty/chromium/ui/gl/gl_bindings_autogen_egl.h:201:5: error: ‘EGLDeviceEXT’ has not been declared
Fails to build against Qt built with Broadcom EGL.
Build against Qt 5.15.2 build with VC4/KMS instead of Broadcom EGL.
Use Qt & QtWebEngine 5.12.10