Installing build dependencies
What to do when you are missing dependencies
If you have any trouble getting things to build due to missing 3rd-party package dependencies, read on to learn what to do. If this guide does not manage to solve your compilation problems, be sure to contact the developers.
How to install all the build dependencies of one package
Often the simplest solution to the problem of missing dependencies is just to install all its required packages at once without needing to search for each dependency individually.
Because most distributions keep track of package dependencies by using source packages, they also provide their own built-in commands to easily install all the build dependencies of each package.
While these commands will not always install all dependencies you will need when compiling KDE software (for example, when compiling with kdesrc-build, where the software is always changing), they will make your dependency resolution faster.
Debian, Ubuntu, Kubuntu, KDE neon
All the build packages known by the package you want to build can be installed with apt build-dep
:
openSUSE
All the build packages known by the package you want to build can be installed with zypper source-install --build-deps-only
:
Note that temporarily enabling the source repositories so that build dependencies can be found is not automatic.
The --plus-content
option will make zypper temporarily enable it to get the info it needs.
Fedora
All the build packages known by the package you want to build can be installed with dnf builddep
:
Note that builddep
will temporarily enable the source repositories so that build dependencies can be found.
Using build errors to find missing dependencies
Whenever you attempt to compile a project and it fails to build, most of the time this is caused by a missing dependency.
Let's say you see the following error when compiling a project:
This error is provided by CMake and it means you are missing the KDE Frameworks 6 library KTextWidgets.
And let's say instead you see the following error when compiling a project:
This means the project is actually using Meson instead of CMake.
Meson projects typically prefer using pkgconfig
over CMake package configuration files.
The error here states that Meson could not find the pkgconfig for gi-docgen
(most likely a file with the extension ".pc") or the CMake file (most likely a file with the extension ".cmake") that contains "gi-docgen" case insensitively in name.
Generic search
There are two types of dependencies, build dependencies and runtime dependencies. The distribution package names for build dependencies usually begin with lib
and/or end in -dev
or -devel
, whereas runtime dependencies usually just start with lib
.
For build dependencies you will likely only need packages that end in -dev
or -devel
, but in some rare cases you might need to install packages starting with lib
too.
In this case, KF6TextWidgets is a build dependency.
The main way to find the package that provides KF6TextWidgets is to grab the name of the library, KF6TextWidgets, strip it from the KF6 part, and search for it in your package manager:
Debian and derivatives:
sudo apt search textwidgets
openSUSE:
sudo zypper search textwidgets
Fedora:
sudo dnf search textwidgets
Arch:
sudo pacman -Ss textwidgets
FreeBSD:
sudo pkg search textwidgets
Just searching for the component usually reveals the right package name, although it ultimately amounts to guessing or trial-and-error.
The usual pattern you will find for dependency packages looks like this:
Debian and derivatives:
lib<packagename>-dev
or<packagename>-dev
openSUSE and Fedora:
kf6-<packagename>-devel
orlibKF6<PackageName>
Arch:
<packagename>
You can also use web shortcuts provided by KRunner, which will open the package search website for each distribution.
For example: open KRunner with Alt + Space, then type: debian: textwidgets
. Your browser will open the "textwidgets" page of the Debian Package Search website automatically.
Finding specific packages using CMake package configuration files
A more efficient way is to use the functionality provided by your package manager to search for the CMake config file:
Debian and derivatives:
apt-file find KF6TextWidgetsConfig.cmake
openSUSE:
zypper what-provides 'cmake(KF6TextWidgets)'
Fedora:
dnf provides 'cmake(KF6TextWidgets)'
Arch:
pkgfile KF6TextWidgetsConfig.cmake
Fedora and openSUSE come with this functionality by default. On Debian, you will need to install apt-file
manually. On Arch, pkgfile
.
If while using apt-file
you get an error similar to the following (in this example, Qt6WaylandScanner):
You can run this to see what package contains this file:
You will get the following output:
So the package you need to install is qt6-wayland-dev-tools
.
Finding specific packages using pkgconfig files
Similarly to the above, certain distributions also allow to query for packages using pkgconfig files:
openSUSE:
zypper what-provides 'pkgconfig(gi-docgen)'
Fedora:
dnf provides 'pkgconfig(gi-docgen)'
Finding missing executables
If the CMake error looks like the following:
The error here states that CMake could not find the executable named "sass" (most likely a file "/usr/bin/sass").
To solve this, you can specifically search for the executable in distribution packages:
Debian and derivatives:
apt-file search /usr/bin/sass
Fedora:
sudo dnf provides sass
openSUSE:
sudo zypper search --provides /usr/bin/sass
Arch:
sudo pacman -F /usr/bin/sass
FreeBSD:
sudo pkg provides sass
Last updated