Get Involved/development/Install the dependencies

From KDE Community Wiki
Revision as of 21:38, 27 June 2023 by Ngraham (talk | contribs) (Remove stuff that duplicates what kdesrc-build --initial-setup does)

In the following we give the dependencies to install. However it might change and this page might be quickly outdated.

Note

If some packages fail to install, you can try removing the ones that don't work from the list.


Reading the CMakeLists.txt of the packages you want to install should help you finding what you really need to install. Or read the error logs (see below).

If you need help, see https://community.kde.org/Get_Involved#Getting_in_Touch_and_Working_Together

Enable the source repositories

Set up kdesrc-build - Step 4/6.

Some operating systems also require that you enable on the source repositories before you can install build dependencies. Do that now, if necessary:

  • KDE neon/Debian/Ubuntu/Kubuntu: sudo sed -i '/deb-src/s/^# //' /etc/apt/sources.list && sudo apt update . Open the file /etc/apt/sources.list in a text editor and make sure that each line that starts with "deb " is followed by an identical line but which starts with "deb-src ". For more information, see https://askubuntu.com/questions/158871/how-do-i-enable-the-source-code-repositories. Note: if the file /etc/apt/sources.list does not contain commented out deb-src lines starting with "#deb-src " and apt build-dep returns errors (e.g. E: You must put some 'deb-src' URIs in your sources.list). Then you should duplicate the lines starting with "deb " and in the copied/duplicated lines, replace "deb " with "deb-src ".
  • openSUSE Leap & Tumbleweed: sudo zypper mr -e $(zypper repos | awk '/source/{print $5}')
  • Gentoo is all built from sources anyway, so in most cases all necessary build dependencies for installed packages will be available from the get-go, but for convenience this page will refer to sets available from KDE ebuild repository:
    emerge eselect-repository && eselect repository enable kde


If you don't see your distro in the above list, then there's nothing you need to do here and you can safely move on.

How to install the dependencies of one package

KDE neon, Debian, Ubuntu, Kubuntu

All the build packages known by the package you want to build can be installed by running:

sudo apt build-dep <package you want to build>

For example, to install the build dependencies for Dolphin, run:

sudo apt build-dep dolphin

Fedora

If dependencies are missing for a specific RPM package, you can run:

sudo dnf builddep <name_of_rpm_package>

For example, to install the build dependencies for Dolphin, run:

sudo dnf builddep dolphin

openSUSE

Generally you can install the required -devel packages that are needed to build some KDE software from source by using zypper (as root, or by using sudo), e.g. to install the -devel packages required to build dolphin from source:

# zypper --plus-content repo-source source-install --build-deps-only dolphin

replace dolphin with some other package name, e.g. to build ktexteditor from source:

# zypper --plus-content repo-source source-install --build-deps-only ktexteditor

Note that the --plus-content option in the above commands means you don't need to have the source repository enabled all the time, --plus-content will make zypper temporarily enable it to get the info it needs.

openSUSE (and most other RPM-based Linux distributions) support cmake() BuildRequires, which means you can install a development package like so:

# zypper install 'cmake(KF5KIO)'

the part between the parenthesis KF5KIO is going to be in the error message that CMake will print in the terminal if you try to build something that requires e.g. KIO if KIO development headers aren't installed.

Any other dependencies can be figured out and installed as you continue building the modules one by one.

Quick fixes for package manager errors

The above lists might not always be working out of the box on your specific distribution or might be out of date for individual packages. In many cases removing single packages from the lists above still allows you to build many KDE frameworks and applications.

In case it is a package added by a regex, you can exclude the specific package by a workaround using sed. Let us assume for an example that we want to install "libkf5.*-dev" on deb-based systems but have uninstallable packages libkf5example1-dev, libkf5example2-dev. Then we install all "libkf5.*-dev" packages excluding libkf5example1-dev and libkf5example2-dev through:

$ sudo apt install $(apt-cache search -n "libkf5.*-dev" | sed 's/ - .*//' | sed '/libkf5example1-dev/d' | sed '/libkf5example2-dev/d')