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.

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

For the frameworks

deb-based distributions (Debian, Neon, Kubuntu...)

$ sudo apt-get build-dep qtbase5-dev

$ sudo apt-get install libbz2-dev libxslt-dev libxml2-dev shared-mime-info oxygen-icon-theme libgif-dev libvlc-dev libvlccore-dev doxygen gperf bzr libxapian-dev fontforge libgcrypt20-dev libattr1-dev network-manager-dev libgtk-3-dev xsltproc xserver-xorg-input-synaptics-dev libpwquality-dev modemmanager-dev libxcb-keysyms1-dev libepoxy-dev libpolkit-agent-1-dev libnm-util-dev libnm-glib-dev libegl1-mesa-dev libxcb-xkb-dev libqt5x11extras5-dev libwww-perl libxml-parser-perl libjson-perl libboost-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libarchive-dev liblmdb-dev cmake git extra-cmake-modules "libkf5.*-dev" llvm llvm-3.9 libclang-3.9-dev bison flex libudev-dev libqt5svg5-dev libqt5texttospeech5-dev qtbase5-private-dev qttools5-dev libjpeg-dev qtquickcontrols2-5-dev libqrencode-dev

If you receive errors regarding "libboost1.55-dev" on recent versions of your distribution, try installing "libboost-dev" instead, which should install a more recent (but still compatible) version of Boost. Older deb-based distributions require at least Boost 1.55 however.

The "libkf5.*-dev" wildcard may also sometimes fail in situations where you are using mixed repositories, where some packages have been renamed and break/replace/conflict with versions that apt can still find in the other older base repository. For example, using development packages from the Kubunu backports PPA on top of the main ubuntu archive. In these cases you should determine the development packages you require, and install the latest versions only.

Xserver development package

Debian:

$ sudo apt-get install xserver-xorg-dev

Ubuntu:
The development package must match the installed xserver or X might break (LTS Versions may have the enablement stack installed)

Check installed xserver

$ dpkg --get-selections | grep xserver-xorg

If above e.g. has this in the list xserver-xorg-hwe-16.04, then:

$ sudo apt-get install xserver-xorg-dev-hwe-16.04

If there is a package that is just called xserver-xorg then xserver-xorg-dev can be used.

openSUSE

openSUSE 13.2 (outdated)

All the necessary dependencies:

$ 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-0_10-devel gstreamer-0_10-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 # for kde-gtk-config
$ sudo zypper in grantlee5 # for kdevplatform
$ sudo zypper in libkdcraw-devel liblcms2-devel # for gwenview

Optional for kdeplasma-addons: libibus >=1.4.2 (see http://software.opensuse.org/package/libibus-1_0-5)

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 42.1

Install these packages (including the recommended packages):

$ sudo zypper install patterns-openSUSE-devel_kde patterns-openSUSE-devel_kde_frameworks git-core bzr ninja \
gettext-tools libqt5-qttools libgypsy0 libqt5-creator libqt5-linguist libqt5-qtbase-common-devel libqt5-qtbase-devel libqt5-qtbase-examples libqt5-qtdeclarative-devel libqt5-qtdeclarative-examples libqt5-qtdeclarative-tools libqt5-qtdoc libqt5-qtgraphicaleffects libqt5-qtimageformats libqt5-qtimageformats-devel libqt5-qtmultimedia-devel libqt5-qtmultimedia-examples libqt5-qtquick1-devel libqt5-qtquickcontrols libqt5-qtscript-devel libqt5-qtscript-examples libqt5-qtsvg-devel libqt5-qttools-devel libqt5-qtx11extras-devel libqt5-qtxmlpatterns-devel libqt5-qtxmlpatterns-examples libQt5CLucene5 libQt5Concurrent-devel libQt5Concurrent5 libQt5Core-devel libQt5Core5 libQt5DBus-devel libQt5DBus5 libQt5Declarative5 libQt5Designer5 libQt5DesignerComponents5 libQt5Gui-devel libQt5Gui5 libQt5Help5 libQt5Multimedia5 libQt5Network-devel libQt5Network5 libQt5OpenGL-devel libQt5OpenGL5 libQt5Positioning5 libQt5PrintSupport-devel libQt5PrintSupport5 libQt5Script5 libQt5Sensors5 libQt5Sql-devel libQt5Sql5 libQt5Sql5-mysql libQt5Sql5-postgresql libQt5Sql5-sqlite libQt5Sql5-unixODBC libQt5Svg5 libQt5Test-devel libQt5Test5 libQt5WebKit5 libQt5WebKitWidgets5 libQt5Widgets-devel libQt5Widgets5 libQt5X11Extras5 libQt5Xml-devel libQt5Xml5 libQt5XmlPatterns5 libQtQuick5 libQt5WebKitWidgets-devel libqt5-qtbase-private-headers-devel \
xcb-util-keysyms-devel docbook-xsl-stylesheets doxygen polkit-devel libepoxy-devel boost-devel libXcursor-devel libSM-devel giflib-devel libaccounts-qt5-devel gtk3-devel libpng16-devel fltk-devel libopenssl-devel libattr-devel ModemManager-devel NetworkManager-devel wayland-devel lmdb-devel xcb-proto-devel xcb-util-image-devel xcb-util-cursor-devel xcb-util-devel gtk2-devel libqca-qt5-devel libpwquality-devel libical-devel PackageKit-Qt5-devel pam-devel \
bison flex libqt5-qttools-doc
  • Failing modules (of more than 200 modules)
    • phonon-vlc, phonon-gstreamer, plasma-pa (PulseAudio missing), kdevplatform, plasma-desktop, kaccounts-integration, kaccounts-mobile, gwenview, kdevelop, libksane, skanlite, ... (see below for solutions)
openSuSE Tumbleweed

This more complete list (which probably works for OpenSuSE 42.1 as well) 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 patterns-kde-devel_kde_frameworks patterns-kde-devel_qt5 make cmake extra-cmake-modules ccache git bzr antlr antlr-java antlr-devel astyle autoconf flac gettext-tools intltool libMagick++-devel libplotter2 libtool pstoedit subversion-devel subversion-tools xscreensaver-data libxslt-devel docbook-xsl-stylesheets libpoppler-devel aspell-devel enchant-devel libidn-devel polkit-devel update-desktop-files atk-devel bluez-devel fdupes gdk-pixbuf-devel gtk3-devel libcanberra-devel libexiv2-devel libpulse-devel gtk-doc libsmbclient-devel libssh-devel libusb-1_0-devel libusb-compat-devel libxine-devel libxklavier16 libxklavier-devel xwininfo NetworkManager-devel ModemManager-devel libssh2-devel openslp-devel pango-devel xz-devel libgssglue-devel libjasper-devel libudev-devel utempter-devel libbotan-devel libmysqlclient-devel postgresql-devel libmysqld-devel cgdb gstreamer-plugins-base-devel gstreamer-devel libsamplerate-devel audiofile-devel flac-devel libvorbis-devel fftw3-devel libmusicbrainz-devel cdparanoia-devel flex parted-devel libopus-devel giflib-devel pciutils-devel pam-devel boost-devel libv4l-devel cyrus-sasl-devel libgpgme-devel libical-devel sane-backends-devel libgphoto2-devel doxygen makeinfo LibVNCServer-devel speex-devel libotr-devel libmms-devel libsndfile-devel mpfr-devel libzeitgeist-devel gperf rbtools libcap-devel libarchive-devel telepathy-logger-devel libpwquality-devel opencv-devel glew-devel libxapian-devel libblkid-devel libatasmart-devel libiodbc-devel xcb-util-wm-devel xcb-util-renderutil-devel xcb-util-keysyms-devel xcb-util-image-devel xcb-util-cursor-devel libxkbcommon-devel vlc-devel libicu-devel icu-data libkolabxml-devel xsd libffi-devel-gcc5 perl-Tie-IxHash perl-JSON perl-Text-CSV perl-YAML-Syck hunspell-devel ffmpeg-devel libacl-devel libnl-devel liboauth-devel libepub-devel libicecream-devel docbook2X liblcms2-devel libeigen2-devel eigen3-devel graphviz-devel liboyranos-devel libraw-devel xf86-input-wacom-devel libwacom-devel xf86-input-synaptics-devel xorg-x11-server-sdk libdiscid-devel libmlt++-devel libdmtx-devel qrencode-devel libfunambol-devel libmtp-devel at-spi2-core-devel openal-soft-devel python-sip-devel libXcm-devel libspeechd-devel libraw-devel ModemManager-devel farstream-devel tesseract-ocr-devel mtdev-devel fontforge-devel cups-devel libepoxy-devel openconnect-devel lmdb-devel libpgf-devel llvm-devel llvm-clang-devel binutils-devel libdwarf-devel libelf-devel plymouth-devel libfakekey-devel python-GitPython php php-curl telepathy-mission-control-devel

Fedora

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

$ sudo dnf install perl-IPC-Cmd perl-JSON-PP perl-YAML-Syck qt5-devel qt5-qtquickcontrols2-devel polkit-devel gperf libxslt-devel libxml2-devel kf5-kconfigwidgets-devel libXrender-devel qrencode-devel xcb*-devel flex systemd-devel giflib-devel libjpeg-turbo-devel NetworkManager-glib-devel NetworkManager-libnm-devel ModemManager-devel libattr-devel openssl-devel libSM-devel wayland-devel lmdb-devel libaccounts-qt5-devel libaccounts-glib-devel signon-devel

Arch Linux

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

$ sudo pacman -Sy --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

For the Frameworks, Plasma, and most of the applications

Plasma 5 will need various dependencies to be installed. You can find a list of dependencies for atleast the frameworks here. Any other dependencies can be figured out and installed as you continue building the modules one by one.

At the very minimum, qt5, cmake, g++, git, bzr, libwww-perl, libjson-perl and libxml-parser-perl needs to be installed to get started.

Ubuntu 14.04 LTS

A guide for building Plasma 5 specifically on Ubuntu 14.04 LTS can be found here.

Neon and Kubuntu

Warning

Building Plasma using these instructions does not work on Kubuntu due to the way they have incorrectly set up Qt.


For KDE Neon and Kubuntu 15.04, here's a list of packages that should satisfy all the dependencies of the default kdesrc-build projects, including Frameworks, Applications and Plasma Workspace but excluding kdegames. Just copy-paste this to your terminal:

sudo apt-get install libxslt1-dev libpolkit-agent-1-dev libpolkit-gobject-1-dev libpolkit-backend-1-dev debhelper dh-apparmor icu-devtools libboost1.55-dev libcln-dev libglib2.0-dev libgmp-dev libgmpxx4ldbl libgps-dev libicu-dev libqalculate-dev libqimageblitz-dev libqt5sensors5 libqt5sensors5-dev libqt5webkit5-dev libqt5x11extras5-dev libraw1394-dev libudev-dev libusb-dev libxapian-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-cursor0 libxcb-damage0-dev libxcb-dpms0 libxcb-dpms0-dev libxcb-ewmh-dev libxcb-ewmh2 libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-record0-dev libxcb-render-util0-dev libxcb-res0 libxcb-res0-dev libxcb-screensaver0 libxcb-screensaver0-dev libxcb-shm0-dev libxcb-util0-dev libxcb-xevie0 libxcb-xevie0-dev libxcb-xf86dri0 libxcb-xf86dri0-dev libxcb-xinerama0 libxcb-xinerama0-dev libxcb-xkb-dev libxcb-xprint0 libxcb-xprint0-dev libxcb-xtest0-dev libxcb-xv0 libxcb-xv0-dev libxcb-xvmc0 libxcb-xvmc0-dev libxml2-dev pkg-kde-tools po-debconf qttools5-dev xcb-proto xvfb qtscript5-dev qtdeclarative5-dev qtbase5-dev qtbase5-dev-tools qt5-qmake doxygen bzr libjson-perl perl-modules cmake cmake-data libapr1 libaprutil1 libserf-1-1 libsvn1 libxml-parser-perl subversion git build-essential libqt5svg5-dev libgpgme11-dev libgcrypt20-dev libepoxy-dev  libssl-dev libjpeg-dev libjpeg-turbo8-dev libjpeg8-dev libgif-dev qtbase5-private-dev qtxmlpatterns5-dev-tools libqt5xmlpatterns5-dev libqt5xmlpatterns5-private-dev libvlc-dev libvlccore-dev gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 libasound2-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libnm-dev libnm-util-dev libnm-glib-dev libattr1-dev qtquick1-5-dev libgrantlee5-dev liblcms2-dev libexiv2-dev libarchive-dev libcups2-dev libfakekey-dev libpam-dev libxrender-dev libpng-dev libxcursor-dev liblmdb-dev libsm-dev libqca-qt5-2-dev libkaccounts-dev libaccounts-glib-dev libtiff5-dev libclang-dev autoconf texinfo libgconf2-dev libcanberra-dev libmlt-dev libmlt++-dev libvncserver-dev libhunspell-dev libfftw3-dev

If you want to use a plasma shell built from source also, you'll need the runtime dependencies from your distribution as well (unless you build your own qt5)

$ sudo apt-get install qml-module-qtquick*

Arch

For Arch, here's a list of packages that should satisfy all the dependencies of the default kdesrc-build projects, including Frameworks, Applications and Plasma Workspace but excluding kdegames. Just copy-paste this to your terminal:

sudo pacman -S base-devel bzr cmake perl-libwww perl-xml-parser perl-json git qt5-tools docbook-xml docbook-xsl python2 boost modemmanager networkmanager vlc xapian-core xorg-server-devel doxygen

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