Building Krita from Source

If you want to help developing Krita, you need to know how to build Krita yourself. If you merely want to run the latest version of Krita, to test a bug or play with, you can use the nightly build for Windows the nightly build for Linux, or the nightly build for macOS.

You can build Krita on Linux, Windows, macOS and on Linux for Android. The libraries Krita needs (for instance to load and save various image types) are called dependencies.

Linux is the easiest operating system to build Krita on because all the libraries that Krita needs are available on most recent Linux distributions. For an easy guide to building Krita see Building Krita on Linux for Cats.

On macOS you can use tools like homebrew to get the dependencies, or build the dependencies manually. Building the dependencies manually is recommended because we have a number of changes to the source for libraries to make them function better with Krita.

On Windows you can either reuse the dependencies from the KDE Binary Factory, or build the dependencies yourself.

On all operating systems, you need to be familiar with using a terminal. Building Krita is a technical task and demands accuracy in following instructions and intelligence in understanding what happens.

Building on Linux

In general, there are two options for building Krita on Linux. One using the docker environment (recommended) and the other is by manually building all the Krita dependencies on the host linux system (unsupported).

Building on Windows

On Windows, you can either reuse the dependencies from the KDE Binary Factory, or build the dependencies yourself. If you decide to build all the dependencies yourself, this will take a long time. Note that you will do all your work in a CMD command window.

This is also more difficult than building Krita on Linux, so you need to pay attention to details. If you follow the guide closely, install correct dependencies and make sure your PATH doesn’t contain anything unwanted, there should be no issues.


  1. Git -

  2. CMake 3.16.0 or later, the latest is usually fine -

  3. Ninja build system -

    • Since Ninja is a single executable, you can place it in the bin folder of CMake, next to cmake.exe for convenience.

  4. LLVM MinGW compiler toolchain

  5. You will also need a release of Python 3.10 (not 3.7, not 3.8, not 3.9, not 3.11) -

    • Make sure to have that version of python.exe in your path. This version of Python will be used for two things to configure Qt and to build the Python scripting module. Do not set PYTHONHOME or PYTHONPATH.

    • Make sure that your Python will have the correct architecture for the version you are trying to build. If building for 32-bit target, you need the 32-bit release of Python.

  6. It is useful to install Qt Creator -

Let op

Make double plus sure you do not have any other compilers or development environments or Python installation in your PATH!

Other Compilers

  • In the past we used mingw-w64 gcc 7.3.0 (mingw-builds). This version is no longer supported because our dependencies started requiring a more updated compiler to work.

  • It is possible to build Krita with a newer mingw-w64 gcc toolchain, for example gcc 11.2.0 by niXman on GitHub (mingw-builds), or the one from MSYS2.

  • MSYS2 can build Krita with the MINGW64, UCRT64 or CLANG64 environments.

  • Krita can also be built with MSVC (check the batch file in build-tools\windows). Krita built with MSVC has suboptimal performance due to codegen issues so we can’t use it.

Let op

If you use these compilers, you must build the dependencies yourself. Trying to mix dependencies built with a different compiler may outright fail to configure, or Krita may appear to build successfully but you get random crashes wuen running it.



After installing the Prerequisites, prepare your working directory somewhere, like C:\krita-dev. Keep this short (30 characters in the prefix path is fine, but longer than this and you may get build errors). Makes sure the path does not contain whitespace. If you use a different path, remember to adjust the paths in the later steps.

mkdir C:\krita-dev
cd /d C:\krita-dev

Set up python environment (you don’t need to hand-craft the bat file with the predefined PATH variables):

git clone
git clone krita-deps-management/ci-utilities

c:\Python310\python.exe -m venv PythonEnv --upgrade-deps
python -m pip install -r krita-deps-management\requirements.txt

Getting the dependencies


Donwload the dependencies and generate the environment file. Make sure you replace the paths to llvm-mingw and ninja:

python krita-deps-management\tools\ --full-krita-env -v PythonEnv -p c:\deps\llvm-mingw-20220906-ucrt-x86_64\bin\ -p c:\deps\llvm-mingw-20220906-ucrt-x86_64\x86_64-w64-mingw32\bin\ -p c:\deps\Ninja\

Let op

If you happen to decide to hand-craft the PATH variable, make sure your PATH variable does not have double backslash symbols \\. Especially as a result of multiple path variables concatenation.

If it has, ASAN symbolizer will crash when parsing error-reports.

Every time you want to build or run your home-grown Krita, open the CMD window, change to the C:\krita-dev folder and run the env.bat file generated by the script above:

cd /d C:\krita-dev

You will note that most command samples below contain these two lines, but the truth is you only need to run env.bat once for each CMD window.

Then get the source code of Krita:

cd /d C:\krita-dev
git clone

Let op

If you build Krita with ASAN, make sure you don’t use prebuilt deps, or at least manually rebuild Qt with ASAN support as well (-DQT_ENABLE_ASAN=ON). There is a know issue in LLVM’s linker, which causes Qt be loaded before ASAN and, therefore, causing some allocations confuse ASAN. Until this issue is fixed, build Qt with ASAN as a workaround.

Building Krita


Again, on the command line, configure the build:

cd /d C:\krita-dev
mkdir -p C:\krita-dev\b_krita
cd b_krita

cmake C:\krita-dev\krita ^
    -DCMAKE_INSTALL_PREFIX=C:/krita-dev/_install ^
    -G Ninja ^

ninja -j8 install

If you are hacking on Krita, you can rebuild Krita without running the full build by entering the build directory and running mingw32-make -j8 install or ninja -j8 install.

cd /d C:\krita-dev
cd b_krita
ninja -j8 install

Running Krita

You must start Krita from the command prompt, after having run env.bat:

cd /d C:\krita-dev
:: or

Building on macOS

We will build Krita on macOS with the same scripts that are used to build the nightly builds and the releases. We will NOT be building krita from within XCode, but from within the terminal.


You will need to install:



Open First you need to create buildroot folder:

export BUILDROOT=$HOME/dev

mkdir -p $BUILDROOT

Now fetch Krita sources, build scripts and set up virtual environment for Python:

git clone

# fetch environment scripts under Krita's source directory
cd krita
git clone krita-deps-management --depth=1
git clone krita-deps-management/ci-utilities --depth=1

# create venv environemnt for running build scripts
python3 -m venv $BUILDROOT/venv --upgrade-deps
source $BUILDROOT/venv/bin/activate
pip install -r krita-deps-management/requirements.txt

Install build tools (CMake, Ninja, CCache) that we use for Krita builds on CI. If you have these tools installed separately, then you can skip this step:

python3 $BUILDROOT/krita/build-tools/ci-scripts/
source $BUILDROOT/_krita-tools/activate

Fetching prebuilt dependencies


Now set up the environment for building Krita and download all the dependencies in a prebuilt form:

cd $BUILDROOT/krita
source $BUILDROOT/venv/bin/activate
source $BUILDROOT/_krita-tools/activate # if you used CI build tools

python krita-deps-management/tools/ --full-krita-env -v $BUILDROOT/venv -p $BUILDROOT/$KDECI_CRAFT_PLATFORM/dev-utils/bin/

The script will generate the following environment for you:

  • $BUILDROOT/krita/_install — the install prefix for Krita with all the deps preinstalled

  • $BUILDROOT/krita/_build — the build folder for Krita

  • $BUILDROOT/krita/env — a script for build environment activation

  • $BUILDROOT/krita/env_deactivate — a script for build environment de-activation

The steps above should be done only once when you set up the environement for the first time. Next time you open the console you should just source the env-file at $BUILDROOT/krita/env, you don’t have to repeat all these steps with craft and python’s environment.

Building Krita


Building Krita is straightforward, just activate the environment and do the build. Everything will be activated automatically.

# go to the Krita source directory
cd $BUILDROOT/krita

# activate the build environment (you don't need to activate
# any previous environments, like Python's venv environment;
# everything is included in this ``env`` file)
source $BUILDROOT/krita/env
source $BUILDROOT/_krita-tools/activate # if you used CI build tools

mkdir -p _build
cd _build

# configure Krita as usual
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_INSTALL_PREFIX=$BUILDROOT/krita/_install \
      -DCMAKE_TOOLCHAIN_FILE=$BUILDROOT/krita/krita-deps-management/tools/macos-toolchain-krita.cmake \

# build and install
ninja -j8 install

This will build and install Krita to $BUILDROOT/krita/_install/bin/

Running Krita

You can run krita in the same terminal window:


If you want to debug krita with lldb:

cd $BUILDROOT/krita
lldb ./_install/bin/
(lldb) target create "./_install/bin/"
Current executable set to './_install/bin/' (x86_64).
(lldb) r

Building on Android

See a dedicated page for building Krita on Android

Building Krita’s dependencies manually

See a dedicated page for building Krita’s dependencies manually