How to build krita6 on windows

I can compile the latest version 5.3 on Windows, but when I try to compile krita6 I encounter a problem where the kf6-related libraries cannot be found. I am currently using vcpkg. Is there any guide on how to compile krita6 on Windows?

1 Like

I haven’t tried building krita 6 yet, but one thing you can do is check out the CI which may include some clues of what you may be missing

1 Like

Follow the regular build guide, but set the dependencies branch to transition.now/qt6

python krita-deps-management\tools\setup-env.py --full-krita-env --branch transition.now/qt6 -v PythonEnv -p c:\deps\llvm-mingw-20240619-ucrt-x86_64\bin\ -p c:\deps\llvm-mingw-20240619-ucrt-x86_64\x86_64-w64-mingw32\bin\ -p c:\deps\Ninja\

which will give you the Qt6 dependencies (Qt6, KFrameworks6, PyQt6, etc).

Then configure Krita with -DBUILD_WITH_QT6=ON.

Also, since you’re on Windows, disable the News on Krita’s welcome page, otherwise Krita 6 will crash. Krita 6 is still experimental and not ready for widespread testing.

1 Like

Thank you so much, your method is very useful, the “–branch transition.now/qt6” command is very important. Before, I just switched “krita-deps-management” from “master” to “transition.now/qt6” in git, but I didn’t know that I also had to add relevant parameters to install python env dependencies. You saved me a lot of time.

Yesterday I was still worried about kf6, and even thought about whether to use cross-compilation technology on Linux to compile the Windows version

It seems that the news bug on the welcome page has been fixed

I’m having the same problem. I’ve successfully built Krita 5.x on Windows 11, but I can’t get Krita 6 to work.

I’m following the build guide step by step.
I’m stuck at the part where I need to download dependencies and set up the environment.

>
python C:\krita-dev4\krita-deps-management\tools\setup-env.py --full-krita-env --branch transition.now/qt6 -v PythonEnv -p c:\llvm-mingw\llvm-mingw-20240619-ucrt-x86_64\bin\ -p c:\llvm-mingw\llvm-mingw-20240619-ucrt-x86_64\x86_64-w64-mingw32\bin\ -p c:\CMake\bin\ninja-win\
Traceback (most recent call last):
  File "C:\krita-dev4\krita-deps-management\tools\..\ci-utilities\run-ci-build.py", line 283, in <module>
    allDependencies = packageRegistry.retrieveDependencies( dependenciesToRetrieve, userFeedback=True )
  File "C:\krita-dev4\krita-deps-management\ci-utilities\components\Package.py", line 240, in retrieveDependencies
    raise Exception("Unable to locate requested dependency in the registry: {} (branch: {}{})".format( identifier, branch, aliasString ))
Exception: Unable to locate requested dependency in the registry: ext_pyqt5-sip (branch: transition.now/qt6)
## Failed to run deps generation script

Besides adding “–branch transition.now/qt6 -v”, what else am I missing?
Could I be doing something wrong when downloading from krita-deps-management.git?
Any advice would be appreciated.

Not entirely sure, but it looks like you might be calling the global python instead of the venv python which is why it can’t locate the packages.

Maybe try something like this or wherever it was created:

C:\krita-dev4\PythonEnv\Scripts\python.exe C:\krita-dev4\krita-deps-management\tools\setup-env.py  ...

Changing the Python path didn’t change the result.
Do I need to modify the contents of krita-deps-management myself…?

Sorry not sure. I haven’t built on windows for a while, but I have this set of instructions saved from the last time, I kind of just copy/paste these each time. I can’t remember if there is anything extra I have to do.

My install paths will differ from yours. Maybe some of this helps. It is mostly in order of operation.

It is important to make sure you run .\PythonEnv\Scripts\activate.bat and .\env.bat as well.

cd c:\
mkdir krita-dev
cd krita-dev

git clone https://invent.kde.org/packaging/krita-deps-management.git
git clone https://invent.kde.org/packaging/krita-ci-utilities.git krita-deps-management/ci-utilities

python -m venv PythonEnv --upgrade-deps

.\PythonEnv\Scripts\activate.bat
C:\krita-dev\PythonEnv\Scripts\python.exe -m pip install -r C:\krita-dev\krita-deps-management\requirements.txt

C:\krita-dev\PythonEnv\Scripts\python.exe krita-deps-management\tools\setup-env.py --full-krita-env -v PythonEnv -p c:\deps\llvm-mingw\bin\ -p c:\deps\llvm-mingw\x86_64-w64-mingw32\bin\

:: get the krita source copy to c:\krita-dev\krita

cd c:\krita-dev
.\env.bat
mkdir -p b_krita
cd b_krita

$env:PATH = "C:\krita-dev\_install\bin;C:\llvm-mingw\bin;" + $env:PATH
cmake C:\krita-dev\krita -DCMAKE_INSTALL_PREFIX=C:\krita-dev/_install -DBUILD_TESTING=ON -DINSTALL_BENCHMARKS=ON -DKRITA_ENABLE_PCH=OFF -DHIDE_SAFE_ASSERTS=OFF -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER="C:\llvm-mingw\bin\clang.exe" -DCMAKE_CXX_COMPILER="C:\llvm-mingw\bin\clang++.exe"
ninja -j8 install

cd c:\krita-dev
.\env.bat
.\_install\bin\krita       

I will try build the qt6 branch a bit later and post back if I spot anything

(post deleted by author)

Have you ever built Krita 6.x? In my case, I’m experiencing some issues in areas that are different from version 5.

Oops, I must have missed that. Thank you for your help.

It’s looking for PyQt5 on the Qt6 branch, so it’s not looking for the right dependencies.
Make sure you switched krita-deps-management’s branch to transition.now/qt6 in git; you should have a folder named ext_pyqt6 and latest/krita-deps.yml should reference “base/pyqt6”.

1 Like

Np. I added that after I initially posted.

So, worked up to your steps and this is what I found.

First thing is the build docs sometimes is a bit behind the actual build steps, but you can see the build steps for windows here: build-tools/ci-scripts/windows.yml · master · Graphics / Krita · GitLab

Sometimes if I get stuck I go look at these to see what I might be missing.

So what I noticed is that you must switch to qt6 branch for krita-deps-management,

git clone https://invent.kde.org/packaging/krita-deps-management.git -b transition.now/qt6 --depth=1 

After that the build steps should work, this is what I have up to that point:

cd c:\
mkdir krita-dev
cd krita-dev


git clone https://invent.kde.org/packaging/krita-deps-management.git -b transition.now/qt6 --depth=1
git clone https://invent.kde.org/packaging/krita-ci-utilities.git krita-deps-management/ci-utilities

python -m venv PythonEnv --upgrade-deps

.\PythonEnv\Scripts\activate.bat
C:\krita-dev\PythonEnv\Scripts\python.exe -m pip install -r C:\krita-dev\krita-deps-management\requirements.txt
C:\krita-dev\PythonEnv\Scripts\python.exe krita-deps-management\tools\setup-env.py --full-krita-env --branch transition.now/qt6 -v PythonEnv -p c:\deps\llvm-mingw\bin\ -p c:\deps\llvm-mingw\x86_64-w64-mingw32\bin\


Can you check if this works for you?

[Just saw the previous answer, was at same time I posted]

1 Like

@vurentjie

@freyalupen

The build was completed successfully. Thank you for your help.:grinning_face:
Since I wasn’t familiar with repositories, I probably wouldn’t have been able to figure this out on my own.