Building Kleopatra git master

There is a lot of documentation available at this page mainly is an example on how you can do this.

See the kleopatra Project page for repository information.


This is a list of dependencies needed system to compile the required frameworks and Kleopatra. Please add additional dependencies if you needed them.

Note: This was written for the full KDEPIM repo and needs to be updated now that Kleopatra is in it's own repository.

Debian Jessie

apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libasound2-dev \
libnss3-dev libjson-perl libx11-xcb1 libx11-xcb-dev libxrender-dev git build-essential cmake \
libgpgme11-dev libgcrypt20-dev docbook-xsl libxslt1-dev libboost1.55-all-dev libsasl2-dev libldap2-dev \
libgif-dev libjpeg-dev libpolkit-backend-1-dev libpolkit-agent-1 xsltproc libssl-dev libxcursor-dev \
libxcomposite-dev libxdamage-dev libxrandr-dev libfontconfig1-dev flex bison gperf\
libicu-dev libxslt-dev ruby ^libxcb.* libglu1-mesa-dev libxi-dev perl python libepoxy\
libical-dev libqrencode-dev libprison-dev libxapian-dev libdmtx-dev libfontconfig1-dev\
libfreetype6-dev libx11-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev\
libx11-xcb-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev\
libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev

Ubuntu Trusty

apt-get build-dep qtbase5-dev
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-dev \
xserver-xorg-input-synaptics-dev libpwquality-dev modemmanager-dev libepoxy libepoxy-dev \
libpolkit-agent-1-dev libnm-util-dev libnm-glib-dev libegl-mesa-dev \
libqt5x11extras5-dev libboost-all-dev libical-dev libsasl2-dev libgpgme11-dev \
libcap-dev libpci-dev libjson-perl libgstreamer1.0-dev docbook-xsl libxslt1-dev libboost1.55-all-dev \
libldap2-dev libjpeg-dev libpolkit-backend-1-dev libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev \
libxrandr-dev libfontconfig1-dev flex bison libicu-dev ruby ^libxcb.* libx11-xcb-dev libglu1-mesa-dev \
libxrender-dev libxi-dev build-essential perl python git libical-dev libqrencode-dev libprison-dev \

Compiling into a custom prefix

This is an example how to compile Kleopatra and installing it into a custom prefix.

The example prefix is kf5. The example snippets use make -j

Preparing the environment

export CUSTOM_PREFIX=~/kf5
mkdir -p $CUSTOM_PREFIX/src

Qt 5

Note: Kleopatra only needs the following modules (while this documentation builds all qt modules): Qt5Widgets Qt5Gui QtWidgets Qt5Core Qt5Tools Qt5Xml Qt5Newtwork Qt5Svg Qt5PrintSupport Qt5WinExtras (for windows)

git clone git:// --branch 5.5
cd qt5
./configure -prefix $CUSTOM_PREFIX/qt5 -opensource -confirm-license -nomake tests -nomake examples -dbus -no-separate-debug-info -xcb -qpa xcb -no-gtkstyle -release -force-debug-info -reduce-relocations -optimized-qmake
make -j`nproc` && make install

KDE Frameworks

You should take a look at the KDE documentation:

Here are my notes how I did this:

git config --global url."git://".insteadOf kde: && \
git config --global url."ssh://".pushInsteadOf kde:

mkdir -p extragear/utils
git clone kde:kdesrc-build extragear/utils/kdesrc-build
ln -s extragear/utils/kdesrc-build/kdesrc-build .
wget "" -O "kdesrc-buildrc"

Now edit the paths in the kdesrc-buildrc.



  qtdir /home/aheinecke/arbeit/kf5/qt5
  source-dir /home/aheinecke/arbeit/kf5/src
  build-dir /home/aheinecke/arbeit/kf5/build
  kdedir /home/aheinecke/arbeit/kf5

  git-repository-base kde-projects kde:

  cmake-options -DCMAKE_BUILD_TYPE:STRING=debug -DKDE4_BUILD_TESTS=false

  make-options -j8

  cxxflags -pipe -DQT_STRICT_ITERATORS -DQURL_NO_CAST_FROM_STRING -DQT_NO_HTTP -DQT_NO_FTP -Wformat -Werror=format-security -Werror=return-type -Wno-variadic-macros -Wlogical-op -Wmissing-include-dirs

  branch-group kf5-qt5

end global

include extragear/utils/kdesrc-build/kf5-qt5-build-include

Now we can start compiling:

./kdesrc-build --include-dependencies kleopatra

Look out for errors and fix them :-)

Runtime Setup

The script is an example that sets up your environment and adds some convenience build functions. Take a look at the script first and edit paths where necessary.

To use KF5 from your prefix set the following environment variables:

export XDG_DATA_DIRS=$KF5/share:$XDG_DATA_DIRS:/usr/share
export XDG_CONFIG_DIRS=$KF5/etc/xdg:$XDG_CONFIG_DIRS:/etc/xdg
export PATH=$KF5/sbin:$KF5/bin:$QTDIR/bin:$PATH
export QT_PLUGIN_PATH=$KF5/lib/plugins:$KF5/lib64/plugins:$KF5/lib/x86_64-linux-gnu/plugins:$QTDIR/plugins:$QT_PLUGIN_PATH
export KDE_FULL_SESSION=true

export XDG_DATA_HOME=$KF5/.local/share
export XDG_CONFIG_HOME=$KF5/.config
export XDG_CACHE_HOME=$KF5/.cache


export PKG_CONFIG_PATH=$KF5/lib/pkgconfig:$PKG_CONFIG_PATH



To get a nicer logging pattern:

export QT_MESSAGE_PATTERN="`echo -e "\033[32m%{time h:mm:ss.zzz}%{if-category}\033[32m %{category}:%{endif} %{if-debug}\033[35m%{function}%{endif}%{if-warning}\033[33m%{backtrace depth=3}%{endif}%{if-critical}\033[31m%{backtrace depth=3}%{endif}%{if-fatal}\033[31m%{backtrace depth=3}%{endif}\033[0m %{message}"`"

To configure logging:

export QT_LOGGING_CONF=$CUSTOM_PREFIX/src/logging.rules
echo [Rules] > $CUSTOM_PREFIX/src/logging.rules
echo log_kleopatra.debug=true  >> $CUSTOM_PREFIX/src/logging.rules
echo kdepim.kleopatra.debug=true  >> $CUSTOM_PREFIX/src/logging.rules


There is a very useful vim script available at: Vim users should take a look at it.

BuildingFromGIT/Kleopatra (last edited 2016-09-05 04:10:18 by JochenSaalfeld)