Getting Started/Build/Environment

Jump to: navigation, search



Git Configuration

Path Configuration

This section explains the different paths that need to be configured for building KDE. The following section will demonstrate a simple method for setting up the required paths.

Source Path

The $KDE_SRC path environment variable defines where the KDE Build System can find the source files.

TODO: Decide how to do stable and unstable source branches in parallel. While Git supports having these in a single source clone, it is sometimes nice to have separate clones to allow simultaneous parallel builds.

Build Path

The $KDE_BUILD path environment variable defines where the KDE Build System will create the build files.

The KDE build system requires that your source and build files be in different directories (aka out-of-source builds). This keeps your source directories clean and simplifies management of your different build files. :

  • It makes it very easy to rebuild from scratch, removing all generated files - even old ones that "make clean" wouldn't remove.
  • It is easier to look at the source files (grep, ls etc.).
  • It allows multiple build trees with different settings, e.g. debug and release.

While for some simple build scenarios you could just create a "build" directory inside your 'source' directory (e.g. "kde/src/kdelibs/build"), this negates many of the advantages when used with a full KDE build. Instead clearly separate paths are recommended.

For example if we were building kdelibs we could have the following folders:


If you plan to build multiple branches of KDE such as stable and unstable in parallel then you will need to add an extra level to the build directory:


Install Path

The $KDEDIR path environment variable defines where the KDE Build System will install KDE.

It is strongly recommended for a development build that you do a user based install and not a root install, i.e. install your KDE build into a separate user folder and not into the system /usr folder. This provides a number of advantages:

  • Your root/system installed version of KDE is untouched, meaning your normal desktop and applications remain stable and usable even if your development build breaks
  • You can build and run multiple development versions of KDE at the same time, i.e. a stable branch for bug fixes and an unstable branch for new features
  • You can use a single alias or script to compile/link/install without having to do a su/sudo in the middle
  • Doing "make" and "make install" as the same user is a lot quicker as the Makefiles are only parsed once.
  • No root owned files in the build directory
  • No problems caused by root not having a correctly configured KDE build environment

That said, the build instructions provided are completely generic and will work for building a root system install if you configure your environment to do so, i.e. for Linux from Scratch or doing a root install in a virtual machine for testing or packaging purposes.

For the kdelibs example given above we would then have:


Home Path

The $KDEHOME path environment variable defines wat directory KDE will treat as your home folder, i.e. for stroing data writing config files to.

For the same reason as the Install Path, it is strongly recommended that you set your KDE Home Path to be different from your normal home folder.

For the kdelibs example given above we would then have:


Environment Configuration

Useful Scripts

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal