Note: Every step is done in Debian 11


1. Download Qt source

The full source can be downloaded from the official site. For instance, my Qt5.15.11 is downloaded from >here<

Download it and extract it to a place you like.

2. Install dependencies

Building Qt needs a ton of dependencies and their names are platform-dependent. First, you need to walk through the actions officially required listed in https://wiki.qt.io/Building_Qt_5_from_Git, then you'll need to go through a painful trial and error stage. Hope what I have installed will help.

Here is a list of components I installed:

apt install llvm  \
libre2-dev  \
libicu-dev  \
libopus-dev  \
libvpx-dev  \
libsnappy-dev  \
libminizip-dev  \
libxml2-dev  \
libxslt-dev  \
libharfbuzz-dev  \
libatspi2.0-dev  \
libwayland-egl-backend-dev  \
libwayland-egl++0  \
libwayland-egl1  \
libwayland-dev  \
libxkbfile-dev  \
libxcursor-dev  \
libxcomposite-dev  \
libxdamage-dev  \
libxrandr-dev  \
libxtst-dev  \
libxss-dev  \
libdbus-1-dev  \
libevent-dev  \
libfontconfig1-dev  \
libcap-dev  \
libpulse-dev  \
libudev-dev  \
libpci-dev  \
libnss3-dev  \
libasound2-dev  \
libegl1-mesa-dev  \
libx11-dev  \
libx11-xcb-dev  \
libxext-dev  \
libxfixes-dev  \
libxi-dev  \
libxrender-dev  \
libxcb1-dev  \
libxcb-glx0-dev  \
libxcb-keysyms1-dev  \
libxcb-image0-dev  \
libxcb-shm0-dev  \
libxcb-icccm4-dev  \
libxcb-sync0-dev  \
libxcb-xfixes0-dev  \
libxcb-shape0-dev  \
libxcb-randr0-dev  \
libxcb-render-util0-dev  \
libxkbcommon-dev  \
libxkbcommon-x11-dev  \
libxcb-xinerama0-dev  \
bison  \
build-essential  \
gperf  \
flex  \
ruby  \
python  \
libbz2-dev  \
libcups2-dev  \
libdrm-dev  \
gyp  \
ninja-build  \
libclang-dev 

3. Compile

Assuming that every component listed is installed without a problem, you should be able to compile the qt source with the following configuration:

./configure -opensource -confirm-license -nomake examples -nomake tests -opengl es2 -egl -xcb -xkbcommon -release
  • If you don't need GUI support, the -xcb -xkbcommon -opengl es2 -egl part can be ignored.
  • If you don't need GUI support, you can append --no-opengl to the commandline so that it won't complain about the missing of opengl libs.
  • You should never use -nomake tools together with webengine building, it will fail.

4. Caveats

  • If something wrong was detected, the config will stop and tell you some info about the interruption. Don't stop there, check the config.log file, it has way more information than what was displayed.
  • Once you have fixed the problem, re-run the configure command, if it still complains the same error, that could because of the cache of its previous detection. append -recheck-all to your command to force it to do a recheck.
  • make and gmake both will work.
  • By default, the compiled QT instance will be installed in /usr/local/Qt[version]. You can change it with the option --prefix