Building Krita 3.0 on Linux for cats
Intro :
Changelog:
[2017-09-09] Remove specific obsolete notes
[2017-08-20] Krita 4.x, and specific notes for Linux Mint 18.2 / Ubuntu 16.04
[2016-04-24] moving from calligra repository, Krita 3.0, adding library for plasma/Qt 5.0
[2015-05-07] Refactoring for using the 2.9 branch while Krita split Calligra
[2013-11-18] First publishing, during Krita 2.7 development
Why?
I wrote this guide after maintaining during a full-year a set of scripts to help user to compile and install Krita. This project was named Compilscripts and I decided to stop supporting it because build script always breaks: when something irregular happens, Compilscript fail and stop to work ... And irregularities are common on Linux. The user is dependent of a system he doesn't understand. And when it breaks, it breaks his production without letting him know how to fix it. That's not a solution. That’s why I thought the best approach is the Arch-way not to give an automatic tool , but creating a documentation dead-easy to make artist independent in the process and understand what they do. Artists should be able to install, update, go back in the history of code if something doesn’t work for them ; all of this with a minimal and easy to use documentation.
Fully illustrated:
I also offer here a set of illustrations about compiling ( all are released under CC-By ). I hope those picture will help other project's documentation to be more user friendly and appear more simple to understand by using a simple analogy : a cat building a house.
But why for cats ?
Because it's well known on the Internet : you can't go wrong with cats.
Setup directories

- /home/<your-user-name>/krita/src for the source code.
- /home/<your-user-name>/krita/build where Krita will be built
- /home/<your-user-name>/krita/inst where Krita will be installed
Note : understand <your-user-name> as your user name on this documentation ( Ex : /home/deevad/krita/src )
To do it, open a Terminal, copy the line under (Ctrl+C) then paste it on the Terminal (Ctrl+Shift+V ) :
mkdir -p ~/krita/src ~/krita/build ~/krita/inst
Also check with your distribution package-manager that no calligra and krita packages are installed.
Use the search field of your package manager and remove packages.
Get the source code

cd ~/krita
Install git from your distribution package-manager ( eg. for Ubuntu; sudo apt install git )
Then ask git to download the source files in your src folder, pasting this line code in the Terminal , on the ~/krita directory :
git clone https://anongit.kde.org/krita.git src
So we enter the Krita source folder, then check if everything is updated :
cd src
git pull
Get the libraries and dependencies

Krita needs a large amount of very fresh libraries and you'll need a GNU/Linux distribution with fresh packages for that ; CentOS, Debian Stable, Linux Mint, Elementary or Ubuntu L.T.S are often too outdated to build Krita...
If your distribution is not listed, or if you don't have the choice, the plan B is to find them one by one on your package manager . it sounds painfull, but no choice.
Configuring

Also, we will inform cmake our directories structure :
cd ~/krita/build cmake -DCMAKE_INSTALL_PREFIX=$HOME/krita/inst $HOME/krita/src -DWITH_GMIC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPRODUCTSET=ALL -DPACKAGERS_BUILD=ON -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF
Building

Still on the folder /krita/build, call make with -j<number>, where <number> has to be replaced with the number of parallel job your processor is able to do ( and +1 recommended sometime ). Mine is a 8 core, let's use -j9 .
make -j9
Tip : if you don't know the number of core you have, this little command will answer you the number :
cat /proc/cpuinfo | grep processor | wc -l
Installing

make install -j9
Path and environment variables

Let's show to your system the right path, inside a Terminal, copy line by line :
export KDEDIRS=$HOME/krita/inst:$KDEDIRS
export PATH=$HOME/krita/inst/bin:$PATH
Unfortunately those environment variable are not persistent, and will be lost after a shutdown or a restart of your system and our bridge will collapse.
To set them at any login , write them with your favorite text editor at the end of your ~/.profile file ( on certain distribution, the profile is named xprofile , check your hidden file in your home/<your-user-name> folder ).
First run

If this one doesn't show Krita, look at your desktop-environment 's documentation : "how to create a custom launcher" .
Updating

Fine, call git again . This time it will only append to your source folder the missing code lines. Not downloading the whole source pack.

cd ~/krita/src/
git pull

cd ~/krita/build
cmake -DCMAKE_INSTALL_PREFIX=$HOME/krita/inst $HOME/krita/src -DWITH_GMIC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DPRODUCTSET=ALL -DPACKAGERS_BUILD=ON -DBUILD_TESTING=OFF -DKDE4_BUILD_TESTS=OFF
make install -j8
If you update daily, you might like to automatise those command by making your own minimal bash script.
Rescuing

It might affect your productivity if you don't know how to 'go back in time' ( ex: your favorite brush doesn't work anymore ).
But If you know how to do it, no issue can really affect you, because you know how to come back to a previous state.

cd ~/krita/src
git log
With git log , you can consult all the last changes to the code, named 'commit' . What interrest us is the long identification number ( ex: cca5819b19e0da3434192c5b352285b987a48796 ). You can scroll git log , copy the ID number then quit ( letter Q on keyboard ). Then time-travel your source directory :
git checkout cca5819b19e0da3434192c5b352285b987a48796
Now, configure, compile, and you'll be again in a safe place. Note that I advice the packages gitg or gitk to have a graphic user interface to visualise git history. Also an online version exist here .
To update again to the actual and fresh from a minute ago source-code named master , simply ask git to come back to it with git checkout then pull to update :
git checkout master
git pull

Conclusion
I hope this documentation will help many user to have good time using Krita development version.Use the comments to give your feedbacks or ask questions, I'll do my best to update the information on this page.
- Krita Git activities and history
- List of the last updated Krita bugs
- Form to enter a Krita bug
- Krita blog
- Krita forum
- Krita IRC channel ( answer can arrive sometime after 1 or 2h, be patient )
Special Thanks :
Boudewijn Rempt, Aurélien Gâteau, M.Beast, Yu Asakusa, Matthieu Harel for feedback and help with corrections.
Gerson Alvarado for Spanish translation.
- Español, by Gerson Alvarado : Lewatoto's blog
- Polish, by Adam Druzd : Adam's blog