Krita/linuxbuild

From KDE Community Wiki
Revision as of 14:44, 14 September 2016 by David2 (talk | contribs) (Arch Linux dependencies: cleanup qt4 dep, add method for user to find fresh info.)

Preparation

This guide explains how to build Krita from standard Qt 5 and KDE Frameworks 5 development packages provided with your favorite linux distribution. Building Krita is fundamentally similiar to building Calligra, but there are a few differences. I am too lazy to copy all of those instructions into this page, it would be nice if you did it though. =)

Debian/Ubuntu dependencies

Here are the names of Krita's dependencies in the Debian repositories.

sudo apt install extra-cmake-modules  libkf5archive-dev libkf5completion-dev libkf5config-dev
libkf5coreaddons-dev libkf5guiaddons-dev libkf5i18n-dev libkf5itemmodels-dev libkf5itemviews-dev
libkf5widgetsaddons-dev libkf5windowsystem-dev libkf5kiocore5 qtbase5-dev libqt5svg5-dev
qtdeclarative5-dev libqt5x11extras5-dev libqt5opengl5-dev libeigen3-dev libxi-dev libboost-all-dev
libopenexr-dev vc-dev libexiv2-dev libgsl0-dev liblcms2-dev libpoppler-qt5-dev shared-mime-info 
libraw-dev libfftw3-dev libopencolorio-dev libcurl-dev libopenjpeg-dev

Arch Linux dependencies

Building Krita 3.x on Arch requires often to check the last PKGBUILD of official Arch Package.

To do this, go to [[1]] and check the 'Source File' ( top-right ) and then open the PKGBUILD file [[2]]. It will give you hint if you miss or need to add a library. At september 2016, the list look like this:

Sudo pacman -S base-devel kio kitemmodels gsl libraw opencolorio exiv2 openexr fftw curl boost-libs hicolor-icon-theme extra-cmake-modules kdoctools python boost eigen vc poppler-qt5 poppler-qt5

Building Krita

Once you have installed the dependencies, you are ready to clone the Krita repository.

cd ~/kf5/src               (Or, wherever you want to download the source code)
git clone git://anongit.kde.org/krita


CMake commands

Krita's build system has diverged from the Calligra build system. For example, Krita does not use productsets any longer.

For your initial build of Krita, you probably don't want to run the tests, so we use -DBUILD_TESTING=OFF. Optimization level RelWithDebInfo is nearly always good enough for everyday debugging, and it can be used to paint with. This command will also create a directory ~/kf5/ for KDE Frameworks. The final installation directory for Krita will be ~/kf5/inst/bin/krita.

cd ~/kf5/build/krita
cmake ~/kf5/src/krita -DCMAKE_INSTALL_PREFIX=~/kf5/inst -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=OFF
make -j8
make install -j8


Remember that you can change build settings with cmake . -DNEW_SETTING or by using cmake-gui found in the package cmake-qt-gui

Environment variables

XDG_DATA_DIRS. You need only one environment variable to run Krita 3:

export XDG_DATA_DIRS=~/kf5/inst/share:$XDG_DATA_DIRS

KRITA_PLUGIN_PATH. Currently, running inside a debugger can be a bit fragile due to plugin loading. Krita's plugins are built in several different paths inside the source directory, and the installation process copies them into a single folder. However the debugger might accidentally not catch onto the plugin installation directory. (For example, if it thinks the plugin path is ./build/krita/plugins/ then it will miss the plugins contained in ./build/plugins/. It may be possible in the future to fix this by altering Krita's codebase, but such large changes are not yet possible until the break with Calligra repo is more complete.)

You can force Krita to look in a specific folder for plugins using the environment variable KRITA_PLUGIN_PATH. For example, using Kubuntu and installing Krita in ~/, I can use a debugger if I set the environment variable:

export KRITA_PLUGIN_PATH="~/kf5/inst/lib/x86_64-linux-gnu"

QT_MESSAGE_FORMAT and QT_LOGGING_RULES See main.cc and http://woboq.com/blog/nice-debug-output-with-qt.html

Troubleshooting

  1. WARNING cmake versions 3.1.3 - 3.2.3 have some problems with automoc so the unittests in krita will not be built. If you happen to have this version of cmake (e.g. Ubuntu 15.10) please build hewer cmake manually and call the binary directly from the build directory