Guidelines and HOWTOs/Build from source/Install the dependencies

From KDE Community Wiki

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

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

  • Kubuntu/Ubuntu/Debian: sudo sed -i '/deb-src/s/^# //' /etc/apt/sources.list && sudo apt update (for more information, see https://askubuntu.com/questions/158871/how-do-i-enable-the-source-code-repositories)
  • 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.

Any dependencies

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

For the frameworks

Arch and Manjaro

All the dependencies used for building frameworks can be installed by running:

$ sudo pacman -Syu --needed phonon-qt5 qt5-webkit qt5-script qt5-svg qt5-tools qt5-x11extras enchant jasper openexr libutempter docbook-xsl shared-mime-info giflib libxss upower udisks2 bzr git doxygen perl-json perl-libwww perl-xml-parser perl-io-socket-ssl akonadi xorg-server-devel libpwquality fontforge eigen libfakekey qca-qt5 xapian-core xsd gperf perl-yaml-syck intltool kdesdk qrencode libdmtx boost ruby-test-unit

Fedora

Most of the dependencies used for building frameworks can be installed by running:

$ sudo dnf install bison flex giflib-devel gperf gpgmepp-devel grantlee-qt5-devel kf5-kconfigwidgets-devel libaccounts-glib-devel libaccounts-qt5-devel libattr-devel libdrm-devel libepoxy-devel libgcrypt-devel libical-devel libinsane-devel libjpeg-turbo-devel libnl3-devel LibRaw-devel libsndfile-devel libSM-devel libXext-devel libxml2-devel libXrender-devel libxslt-devel libXtst-devel lm_sensors-devel lmdb-devel meson ModemManager-devel NetworkManager-libnm-devel ninja-build openal-soft-devel openjpeg2-devel openjpeg-devel openssl-devel perl-FindBin perl-IPC-Cmd perl-JSON-PP perl-YAML-Syck polkit-devel qgpgme-devel qrencode-devel qtkeychain-qt5-devel signon-devel systemd-devel wayland-devel xcb*-devel libqalculate* dbus-glib-devel* libmission-control-plugins* gmp-ecm* itstool libsmbclient-devel kdsoap-devel libssh-devel libmtp-devel libtirpc-devel openexr-devel qaccessibilityclient-devel vlc-devel gstreamer1-plugins-base-devel qt5-qttools-static qt5-qtbase-static qt5-qtdeclarative-devel

If deps are missing for a specific package, you can do `sudo dnf builddep <package>`.

Fix for QCA build Library Problems (Fedora 35) sudo ln -s /usr/lib64/libpthread.so.0 /usr/lib64/libpthread.so sudo ln -s /usr/lib64/libdl.so.2 /usr/lib64/libdl.so

Gentoo

Make use of sets provided by KDE ebuild repository to ensure all frameworks packages are installed, thus pulling in all necessary dependencies.

# emerge --ask --verbose @kde-frameworks

Pay attention to the resulting list of packages to be installed and enable additional USE flags to ensure optional dependencies are installed as well.

openSUSE

Installing required development packages with zypper

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.

openSUSE Leap 15 (Argon)

Updated 24 June 2018 (likely incomplete)

$ sudo zypper si -d libqt5-qtbase
$ sudo zypper in libbz2-devel libxslt-devel libxml2-devel shared-mime-info oxygen-icon-theme giflib-devel vlc-devel doxygen gstreamer-devel gstreamer-plugins-base-devel docbook-xml-slides docbook-xsl-stylesheets xcb-util-keysyms-devel perl-JSON boost-devel libxcb-devel libXrender-devel xcb-util-wm-devel xcb-util-devel xcb-util-image-devel gettext-tools libepoxy-devel
$ sudo zypper in gtk3-devel
$ sudo zypper in grantlee5-devel kactivities5-devel plasma-framework-devel plasma5-addons-devel plasma5-workspace-devel libQt5Concurrent-devel libQt5DBus-devel libQt5PrintSupport-devel xcb-util-cursor-devel libqt5-qtx11extras-devel xcb-proto-devel git-core

openSUSE Tumbleweed

This more complete list allows to compile everything that kdesrc-build's default setup (kf5-qt5-build-include) compiles. Note that it doesn't contain Qt or Qt-based libs, you need that on top, or to compile your own Qt (and then include custom-qt5-libs-build-include in kdesrc-buildrc).

$ sudo zypper install aspell-devel atk-devel at-spi2-core-devel audiofile-devel autoconf binutils-devel bluez-devel boost-devel cdparanoia-devel cmake cmark-devel cups-devel cyrus-sasl-devel docbook2X docbook-xsl-stylesheets doxygen eigen3-devel enchant-devel exiv2-devel farstream-devel fdupes ffmpeg-4-libavcodec-devel ffmpeg-4-libavformat-devel ffmpeg-devel fftw3-devel flac-devel flatpak-devel fuse3-devel fwupd-devel gdk-pixbuf-devel gettext-tools giflib-devel git glew-devel grantlee5-devel graphviz-devel gstreamer-devel gstreamermm-devel gstreamer-plugins-bad gstreamer-plugins-base-devel gstreamer-rtsp-server-devel gstreamer-transcoder-devel gstreamer-validate-devel gtk2-devel gtk3-devel hunspell-devel ibus-devel id3lib-devel intltool kcolorpicker-devel kdsoap-devel kimageannotator-devel libaccounts-glib-devel libaccounts-qt5-devel libacl-devel libarchive-devel libassuan-devel libatasmart-devel libattr-devel libblkid-devel libbotan-devel libcanberra-devel libcap-devel libdiscid-devel libdmtx-devel libdwarf-devel libelf-devel libepoxy-devel libepub-devel libepubgen-devel libexiv2-devel libfakekey-devel libffmpegthumbnailer-devel libgbm-devel libgit2-devel libgpgme-devel libgphoto2-devel libgpgmepp-devel libgssglue-devel libgumbo-devel libical-devel libicecream-devel libicu-devel libidn-devel libimobiledevice-devel libiodbc-devel libjasper-devel libkdsoap2 libkolabxml-devel libksane-devel liblcms2-devel libMagick++-devel libmlt++-devel libmms-devel libmtp-devel libmusicbrainz-devel libmysqlclient-devel libmysqld-devel libnl3-devel liboauth-devel libopenssl-devel libopus-devel libotr-devel liboyranos-devel libpcap-devel libpgf-devel libpoppler-devel libpulse-devel libpwquality-devel libqalculate-devel libqgpgme-devel libQt5Charts5-devel libQt5Core-private-headers-devel libQt5PlatformSupport-private-headers-devel libQt5PrintSupport-private-headers-devel libqt5-qtcharts-imports libqt5-qtwayland-private-headers-devel libQt5QuickControls2-devel libraw-devel libsamplerate-devel libsensors4-devel libsignon-qt5-devel libsmbclient-devel libsndfile-devel libspeechd-devel libssh2-devel libssh-devel libudev-devel libusb-1_0-devel libusb-compat-devel libv4l-devel LibVNCServer-devel libvorbis-devel libwacom-devel libxapian-devel libXcm-devel libxkbcommon-devel libxslt-devel libXtst-devel libzeitgeist-devel llvm-clang-devel llvm-devel lmdb-devel make ModemManager-devel mpfr-devel mtdev-devel mozilla-nss-devel NetworkManager-devel openal-soft-devel openconnect-devel opencv-devel openjpeg2-devel openslp-devel PackageKit-devel PackageKit-Qt-devel pam-devel pango-devel parted-devel patterns-kde-devel_kde_frameworks patterns-kde-devel_qt5 pciutils-devel pipewire-devel plymouth-devel polkit-devel postgresql-devel python3 python3-devel python3-openpyxl python3-pycairo python3-python-dateutil qca-qt5-devel qrencode-devel qtkeychain-qt5-devel sane-backends-devel sassc speex-devel taglib tesseract-ocr-devel utempter-devel vlc-devel wayland-protocols-devel wayland-utils xcb-util-cursor-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xf86-input-evdev-devel xf86-input-libinput-devel xf86-input-synaptics-devel xf86-input-wacom-devel xorg-x11-devel xorg-x11-server-sdk xorg-x11-util-devel xz-devel
  • OPEN ISSUES:
    • libeigen2-devel is no longer available on Tumbleweed via official repos, though it's only needed for kdelibs4support

For Plasma

  • Arch/Antergos/Manjaro: sudo pacman -Syu --needed plasma-desktop plasma-wayland-session plasma-workspace kwin
  • Fedora: sudo dnf install libpcap-devel libnl3-devel libsecret-devel; sudo dnf builddep bluedevil breeze-gtk kde-gtk-config kgamma kscreen kwin plasma-breeze plasma-desktop plasma-discover plasma-disks plasma-drkonqi plasma-firewall plasma-integration plasma-milou plasma-nm plasma-pa plasma-systemmonitor plasma-systemsettings plasma-thunderbolt plasma-vault plasma-wayland-protocols plasma-workspace plasma-workspace-geolocation plasma-workspace-wallpapers plymouth-kcm powerdevil sddm-kcm
  • Gentoo: emerge --ask --verbose @kde-plasma
  • KDE neon/Kubuntu/Ubuntu/Debian sudo apt build-dep plasma-desktop plasma-workspace kwin
  • openSUSE Leap & Tumbleweed: sudo zypper si -d plasma5-desktop plasma5-workspace kwin5

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

Though qt6 is listed as an optional dependency in the build phase and already available in some Linux distros, only building with qt5 is currently supported. See https://bugs.kde.org/show_bug.cgi?id=442296

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')