[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
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.
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.
- /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
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 :
Get the libraries and dependencies
Krita needs a large amount of very fresh libraries (you'll need a GNU/Linux distribution with fresh packages) and there is not always a single command to get them.
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. In your sources, the file ~/krita/src/krita/3rdparty/README.md might help you to get advanced informations. ( you can also read an online version here ).
Specific instruction for Linux Mint 18.x / Ubuntu 16.04 :
sudo apt install build-essential libcurl4-gnutls-dev libtiff5-dev libjpeg-turbo8-dev libpng12-dev \ cmake git 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 libexiv2-dev libgsl0-dev liblcms2-dev \ libpoppler-qt5-dev shared-mime-info libraw-dev libfftw3-dev libopencolorio-dev libopenjpeg-dev vc-dev \ libpython3-dev libpython3.5-devYou'll also need a recent Qt version following this comment on /opt/ (I'm using 5.6.2 ; avoid 5.7 series ) and a ECM built from source as adviced here, and a newer Vc built from sources (check the exellent README.md) in /opt/ too. During configuring with cmake, don't forget to add special flag for cmake to process the additional library in /opt/ folders to your path: (eg: -DCMAKE_PREFIX_PATH=/opt/qt56 -DCMAKE_PREFIX_PATH=/opt/Vc )
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
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 .
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
make install -j9
Path and environment variables
Let's show to your system the right path, inside a Terminal, copy line by line :
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 ).
If this one doesn't show Krita, look at your desktop-environment 's documentation : "how to create a custom launcher" .
Fine, call git again . This time it will only append to your source folder the missing code lines. Not downloading the whole source pack.
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.
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.
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
ConclusionI 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.
Useful Links :
- Official Krita development wiki 'Build instructions'.
- 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.