Difference between revisions of "Krita/linuxbuild"

(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Preparation ==
Please check the manual: [https://docs.krita.org/en/untranslatable_pages.html Contributors Manual]
This guide explains how to build Krita from standard Qt 5 and KDE Frameworks 5 development packages provided with your favorite linux distribution.  This should be straightforward, but for more detail you can look into the old instructions for [https://community.kde.org/Calligra/Building/3 building Calligra.]
=== 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  \
libkf5crash-dev \
libkf5kio-dev \
qtbase5-dev  \
libqt5svg5-dev \
libqt5multimedia5 \
qtdeclarative5-dev  \
libqt5x11extras5-dev  \
libqt5opengl5-dev \
libeigen3-dev \
libxi-dev \
libboost-all-dev \
libopenexr-dev  \
vc-dev \
libexiv2-dev \
libgsl-dev \
liblcms2-dev \
libpoppler-qt5-dev \
shared-mime-info  \
libraw-dev \
libfftw3-dev \
libpng-dev \
'''Notes: '''
Ubuntu L.T.S and its derivatives (Linux Mint/Elementary) use too old packages to build Krita 4.x. If you want to compile Krita, use the short term support releases. You'll also need to compile with this flags during cmake:
  -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYQT_SIP_DIR_OVERRIDE=/usr/share/sip/PyQt5
If you compile a custom version of library (eg. a more recent Qt version  in /opt ), you can add the path to this type of flag to let Krita know about it.
vc-dev is called libvc-dev in debian official apt repos, and this should replace vc-dev in the above list.
=== 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 [[https://www.archlinux.org/packages/extra/i686/krita/]] and check the 'Source File' ( top-right ) and then open the PKGBUILD file [[https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/krita]]. 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 --needed 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
=== Fedora dependencies ===
sudo dnf install -y extra-cmake-modules \
  make cmake automake gcc gcc-c++ kernel-devel \
  kf5-karchive-devel \
  kf5-kcompletion-devel \
  kf5-kconfig-devel \
  kf5-kcoreaddons-devel \
  kf5-kguiaddons-devel \
  kf5-ki18n-devel \
  kf5-kitemmodels-devel \
  kf5-kitemviews-devel \
  kf5-kwidgetsaddons-devel \
  kf5-kwindowsystem-devel \
  kf5-kio-core \
  kf5-kcrash-devel \
  kf5-kio-devel \
  qt5-qtbase \
  qt5-qtbase-devel \
  qt5-qtsvg-devel \
  qt5-qtmultimedia qt5-qtmultimedia-devel \
  qt5-qtdeclarative-devel \
  qt5-qtx11extras-devel \
  eigen3-devel \
  libXi-devel \
  boost-* boost-*-devel \
  OpenEXR-libs OpenEXR-devel \
  exiv2-libs exiv2-devel libgexiv2 \
  gsl-devel \
  lcms2-devel \
  poppler-qt5-devel \
  shared-mime-info \
  LibRaw-devel \
  fftw-devel \
  libpng-devel \
== 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.
Optimization level <tt>RelWithDebInfo</tt> is nearly always good enough for everyday debugging, and it can be used to paint with. Basically we have two build modes: for painters and for developers.
<b>For painters:</b>
* disable unittests so  the build becomes faster
* disable safe asserts. it means when a not-too-serious problem arises, Krita will just dump a warning message into the console instead of crashing with an assert.
cd ~/kf5/build/krita
cmake ~/kf5/src/krita \                        ## your source directory
    -DCMAKE_INSTALL_PREFIX=~/kf5/inst \          ## your installation directory
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
make -j8 install
<b>For developers:</b>
* enable unittests so you never break the builds
* enable safe asserts. If a safe assert happens, it means there is a bug in Krita and should be fixed, even though recovery procedure can workaround it.
cd ~/kf5/build/krita
cmake ~/kf5/src/krita \                        ## your source directory
    -DCMAKE_INSTALL_PREFIX=~/kf5/inst \          ## your installation directory
    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
make -j8 install
Remember that you can change build settings with <tt>cmake . -DNEW_SETTING</tt>  or by using <tt>cmake-gui</tt> found in the package <tt>cmake-qt-gui</tt>
== 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 <tt>./build/krita/plugins/</tt> then it will miss the plugins contained in <tt>./build/plugins/</tt>.  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 <tt>KRITA_PLUGIN_PATH</tt>.  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"
See <tt>main.cc</tt> and http://woboq.com/blog/nice-debug-output-with-qt.html
== Troubleshooting ==
# When '''building master and SIP''' you might want to add <tt>-DPYQT_SIP_DIR_OVERRIDE=/usr/share/sip/PyQt5/</tt> to make it find the files correctly. This is a bug in the current cmake files that will be fixed later.
# '''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

Latest revision as of 11:12, 15 January 2019

Please check the manual: Contributors Manual

This page was last edited on 15 January 2019, at 11:12. Content is available under Creative Commons License SA 4.0 unless otherwise noted.