Getting Started
In this chapter, we show how to use the &kdesrc-build; to checkout modules from
the &kde; repository and build them. We also provide a basic explanation of the
&kde; source code structure and the steps you have to perform before running
the script.
All topics present in this chapter are covered with even more detail in the
Build from Source article, at the
&kde; Community Wiki.
If you are compiling &kde; for the first time, it is a good idea to read
it, or consult it as a reference source. You will find detailed information
about packaging tools and requirements, common compilation pitfalls and
strategies and information about running your new &kde; installation.
Preparing the System to Build &kde;Setup a new user account
It is recommended that you use a different user account to build, install,
and run your &kde; software from, since less permissions are required, and
to avoid interfering with your distribution's packages.
If you already have &kde; packages installed, the best choice
would be to create a different (dedicated) user to build and run the new &kde;.
Leaving your system &kde; untouched also allows you to have an
emergency fallback in case a coding mistake causes your latest software build
to be unusable.
You can do also setup to install to a system-wide directory (⪚ /usr/src/local) if you wish. This document
does not cover this installation type, since we assume you know what you are doing.
Ensure your system is ready to build &kde; softwareBefore using the &kdesrc-build; script (or any other building
strategy) you must install the development tools and libraries needed for &kde;.
The nearly complete list of required tools can be found from
the &kde;
Community Wiki Build Requirements page.
Here is a list of some of the things you will need:You will need &cmake;, this software is what &kde; uses to handle
build-time configuration of the source code and generation of the specific build
commands for your system. The required version will vary
depending on what versions of &kde; software you are building (see TechBase for
specifics), but with modern distributions the &cmake; included with your distribution
should be quite sufficient.
You must also install the source control clients needed to checkout
the &kde; source code. This means you need at least the following:The Git
source control manager, which is used for all &kde; source codeAlthough it is not required, the Bazaar source control manager is
used for a single module (libdbusmenu-qt) that is required for the &kde;
libraries. Most users can install this library through their distribution
packages but &kdesrc-build; supports building it as well if you desire. But to
build libdbusmenu-qt, you must have Bazaar installed.The Perl scripting language is required for &kdesrc-build;, some &kde;
repositories, and &Qt; (if you build that from source).The Perl that comes with your distribution should be suitable (it needs to be at
least Perl 5.14), but you will also need some additional modules (&kdesrc-build;
will warn if they are not present):IO::Socket::SSLJSON::PP or JSON::XSYAML::PP, YAML::XS, or YAML::SyckYou will need a full C++ development environment (compiler, standard library, runtime,
and any required development packages). The minimum required versions vary based on the &kde; module:
the &kde; Frameworks 5 collection supports the oldest compilers, while &kde; Plasma 5 and &kde; Applications
tend to require more recent compilers.The GCC 4.8 or Clang 4 compilers are the minimum recommended. Many distributions support easily
installing these tools using a build-essentials package, an option to install
"build dependencies" with &Qt;, or similar features. The KDE Community Wiki has a page tracking
recommended packages for major distributions.
You will need a build tool that actually performs the
compilation steps (as generated by &cmake;). GNU Make is recommended and should
be available through your package manager. &cmake; does support others options, such
as the &ninja; build tool, which can be used by &kdesrc-build; using the
custom-build-command configuration file
option.
Finally, you will need the appropriate &Qt; libraries (including development packages)
for the version of &kde; software you are building. &kdesrc-build; does not officially support building &Qt; 5 (the current major version), so it is recommended to use your distribution's development packages or to
see the KDE Community wiki page on self-building Qt 5.
Most operating system distributions include a method of easily
installing required development tools. Consult the Community Wiki page Required devel packages to see
if these instructions are already available.
Some of these packages are divided into libraries (or programs or utilities),
and development packages. You will need at least the program or library
and its development package.
Setup &kdesrc-build;Install &kdesrc-build;
The &kde; developers make frequent changes to &kdesrc-build; to keep it in
sync with advances in &kde; development, including improvements to the
recommended &kdesrc-build; configuration, added modules, improving &cmake;
flags, &etc;Because of this, we recommend obtaining &kdesrc-build; directly from its
source repository and then periodically updating it.You can obtain &kdesrc-build; from its source repository by running:$ git Replace with
the directory you would like to install to.
You can update &kdesrc-build; later by running:$ cd $ git We recommend adding the &kdesrc-build; installation directory to
your PATH environment variable, so that you can run &kdesrc-build;
without having to fully specify its path every time.Prepare the configuration file&kdesrc-build; uses a configuration file
to control which modules are built, where they are installed to, etc.
This file is located at ~/.config/kdesrc-buildrc
($XDG_CONFIG_HOME/kdesrc-buildrc, if
$XDG_CONFIG_HOME is set).You can use kdesrc-build --generate-config in order to prepare a simple
kdesrc-build configuration. You can then edit the
~/.config/kdesrc-buildrc configuration file to make
any changes you see fit.Manual setup of configuration fileYou can also setup your configuration file manually, by copying the
included sample configuration file kdesrc-buildrc-kf5-sample
to ~/.config/kdesrc-buildrc and then editing the file.
will be a useful reference for this, especially
its table of configuration options.
&kdesrc-build; contains many recommended configuration files to support
&kde; Frameworks 5, &plasma; 5, and other &kde; applications. See
for information on how to use other
configuration files from your own kdesrc-buildrc.
You can find more information about the syntax of the configuration file in and in .
&configure-data;
&building-and-troubleshooting;
&building-specific-modules;
&environment;
&kde-modules-and-selection;
&quick-start-conclusion;