Need help importing krita project into qt creator

I’ve bee able to build krita from the command line without problems, so all the files and modules are present where they need to be. Qt Creator says you need to open a new project and choose the cmakelist.tx file as the project file. That just errored out immediately for lack of the environment variables. So I tried bringing in the contents of the env.bat file I used from the command line, I think I have that correct. Here’s the top of the edited cmakelist file

cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)
set (MINGW_BIN_DIR=C:/llvm-mingw/llvm-mingw-20220906-ucrt-x86_64/bin)
set (CMAKE_BIN_DIR=C:/Program Files/CMake/bin)
set (NINJA_BIN_DIR=C:/Program Files/CMake/bin)
set (PYTHON_BIN_DIR=C:/Users/Administrator/AppData/Local/Programs/Python/Python310)
set (QTCREATOR_DIR=C:/Qt/Tools/qtcreator-11.0.0/bin)
set (BUILDROOT=C:/krita-dev)
set (PATH=C:/krita-dev/i/bin;C:/krita-dev/i/lib;%MINGW_BIN_DIR%;%MINGW_BIN_DIR%/…/x86_64-w64-mingw32/bin;%CMAKE_BIN_DIR%;%NINJA_BIN_DIR%;%QTCREATOR_DIR%;%PATH%)

Then I got errors about the compiler binaries not being defined, so I added them.

set(CMAKE_CXX_COMPILER “C:/llvm-mingw/llvm-mingw-20220906-ucrt-x86_64/bin/clang++.exe”)
set(CMAKE_C_COMPILER “C:/llvm-mingw/llvm-mingw-20220906-ucrt-x86_64/bin/clang.exe”)

And now I’m stuck with this error:

C:\krita-dev\krita\CMakeLists.txt:358: error: By not providing “FindECM.cmake” in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by “ECM”, but CMake did not find one. Could not find a package configuration file provided by “ECM” (requested version 5.22) with any of the following names: ECMConfig.cmake ecm-config.cmake Add the installation prefix of “ECM” to CMAKE_PREFIX_PATH or set “ECM_DIR” to a directory containing one of the above files. If “ECM” provides a separate development package or SDK, be sure it has been installed.

I’ve tried adding “C:/krita-dev/i/share/ECM/cmake” in the set PATH line, I’ve tried adding the constants complains aren’t there.

set(ECM_FIND_MODULE_DIR=C:/krita-dev/i/share/ECM/find-modules)
set(ECM_MODULE_DIR=C:/krita-dev/i/share/ECM/modules)
set(ECM_KDE_MODULE_DIR=C:/krita-dev/i/share/ECM/kde-modules)
set(ECM_PREFIX=C:/krita-dev/i/share)
set(ECM_MODULE_PATH “${ECM_MODULE_DIR}” “${ECM_FIND_MODULE_DIR}” “${ECM_KDE_MODULE_DIR}”)

I’ve tried defining ECM_DIR, but still it pukes right here every time:

find_package(ECM 5.22 REQUIRED NOMODULE)

Am I missing something simple here?

Any help would be greatly appreciated.

Hey, I haven’t tried setting up QtCreator recently (I’m lazy), but last time I did this exercise, I followed this video and it worked without any issues:

If you haven’t used it, maybe check if you haven’t missed any step.

3 Likes

You shouldn’t need to edit CMakeLists.txt. (But you can edit b_krita/CMakeCache.txt.)

I don’t remember how I set up Qt Creator (I did once, but don’t use it), but there should be a way to tell it about your paths and such. I think it’s Edit>Preferences>Kits, as described on this page: Adding Kits | Qt Creator Manual , and you can put the environment variables in Environment, and set the compiler and Qt path.

I assume the video describes that and more, so I would take the word of it over mine. :slight_smile:

1 Like

Thanks for the video link, I googled a ton of times trying to find anything close to this useful :wink:

I’m going to give this a try this afternoon, in the first minute of this video there are things that were never mentioned in any of the tutorials I found about importing make file projects into qt creator, much less explained.

And for anyone else trying to watch this, it won’t play in the latest firefox, I’m using V115.03, you’ll get this error eventually:

Did Not Connect: Potential Security Issue
Firefox detected a potential security threat and did not continue to youtube-ui.l.google.com because this website requires a secure connection.
What can you do about it?
youtube-ui.l.google.com has a security policy called HTTP Strict Transport Security (HSTS), which means that Firefox can only connect to it securely. You can’t add an exception to visit this site…
The issue is most likely with the website, and there is nothing you can do to resolve it. You can notify the website’s administrator about the problem.

This just means it failed it’s security certificate check, firefox is really strict on HTTPS certificates, just use another browser :wink:

Thanks for the heads up, the last time I worked on a C++ make file project was in in 1993, when apple still required it for certified developer projects, I’m a tad out of practice :stuck_out_tongue:

Turns out that was my ad blocker causing the problem.

1 Like

Watched the video, followed the steps exactly, got the same error :face_with_diagonal_mouth:

The one difference from the video is that I can’t find qmake anywhere in the qt creator installation and qt creator doesn’t show it in the kit setup. Also when I try to link the qt install in creator it doesn’t accept the install directory c:\Qt as a valid Qt install. When I search online about how to find qmake in the Qt install the only answer given to anyone asking in the last 8 years is “run the online installer and it will be there”, well I did, and it isn’t. Apparently qmake can’t be downloaded as a file from anywhere either.

So, after about 6 hours and 4 tries, I’m right where I started again.

I’m going to try to reinstall qt creator again, let’s just say, I’m less than optimistic it will change anything.

I reinstalled Qt, it looks like there’s more files there than before, and I do see about a half dozen copies of qmake in the installation. Plus Qt Creator isn’t asking for a valid Qt installation any more, so that’s an improvement already :slight_smile:
I will start from scratch again tomorrow, build krita from the command line, and go through the video to set up the project in Qt Creator.

Who knows, maybe It’ll work this time :crossed_fingers:

OK, I got some sleep last night and I just took a look at the Qt install, now I know what went wrong. They say 80%-85% of software and hardware tech support issues are the result of user error, and that was the problem here. After I installed the required tools, mingw, cmake, ninja, etc, I got to step 7 of the “Building Krita on Windows” instructions:

It is useful to install Qt Creator

So that’s what I did, I installed Qt Creator and chose the “get started fast” option which only installed Qt Creator “if you already have the compilers, tools, etc”. What I got was Qt Creator, and none of the 33+ gigabytes of the actual Qt install :man_facepalming:

Yes, I’m really that stupid when I’m sleep deprived :face_with_diagonal_mouth:

Moving on then.
I’ll take another crack at it now that everything for Qt is actually there, once I get this figured out, and I will, I’ll post a complete guide on how to do this, including some stupid user tricks to avoid :wink:

Thanks for your help and patience everyone, I might not be done asking questions yet :slight_smile:

“We Have Met the Enemy and He Is Us” – Pogo (Walt Kelly)

1 Like

Hi @bubbastien , I don’t think you need any of the Qt stuff. Only the IDE itself. Krita comes with all the dependencies prepared on Windows (they get downloaded as part of the build scripts). I think this is only the matter of setting your Build Kit in Qt and reusing the build directory for the command line build.

Let me share how this looks on my end, I hope this will provide some help. I’ll post in a moment.

2 Likes

I checked my build again today, I used the tip of krita/5.2 branch as that’s the current beta.

Same as you, I first verified a command line build is working. In my case, I have it set up like this (for reference):

env.bat file that I invoke to set up the variables

@echo off
set MINGW_DIR=C:\Apps\llvm-mingw
set PYTHON_BIN_DIR=C:\Program Files\Python310
set QTCREATOR_DIR=C:\Qt\Tools\QtCreator\bin

set BUILDROOT=C:\Users\Maciek\krita-dev
set PATH=%BUILDROOT%\i\bin;%BUILDROOT%\i\lib;%MINGW_DIR%\bin;%MINGW_DIR%\x86_64-w64-mingw32\bin;%PATH%

build.bat file to kick off the build

@echo off
if [%BUILDROOT%]==[] (
    echo BUILDROOT not set! Call env.bat
    exit /b 1
)
if [%1]==[clean] (
    rmdir /q/s b_krita b_plugins
)

krita\build-tools\windows\build.cmd --no-interactive --jobs 30 --skip-deps --download-dir %BUILDROOT%\d --deps-install-dir %BUILDROOT%\i --krita-build-dir %BUILDROOT%\b_krita --plugins-build-dir %BUILDROOT%\b_plugins --krita-install-dir %BUILDROOT%\i

Once I confirmed this works, this is how I set up Qt.

First step is I defined a new Qt Kit that will be used with Krita:

Note that it uses Ninja, CMake Configuration is empty and it refers to LLVM toolchain I installed separately as instructed in the docs.

Debuggers:

Compilers:

Qt Versions:

Now to open the project, I opened CMakeLists.txt from Krita source checkout and made two important tweaks:

  • Used my Qt Kit prepared for Krita specifically
  • Change the default build directory to the one generated by command line scripts
  • And I only picked one build config, to keep it simple

Then I pressed Configure Project. So the trick here is a) to reuse the build directory, b) have a specialized Kit that provides the correct compilers/debuggers/Ninja, etc.

This way you should be able to build. I hope this works for you too!

2 Likes

Thank you, that’s very very helpful :slight_smile:
One quick question, which MinGW binaries are you using for C and C++ ?

I used clang and g++ but didn’t get far enough to se if they’d actually work. Now that I have qmake on this box, I think I’ll get there next try :wink:

Right, I should have included that. It’s just the stuff from my LLVM-MINGW install. This is the version recommended by the official docs, llvm-mingw-20220906-ucrt-x86_64.

For C

And for C++

2 Likes

YAY!!! :fireworks: :partying_face: :sparkler:

I got Krita to build in Qt Creator, tried to run it from the command line, it worked perfectly, then tried to run it in Qt Creator and got the error - could not find libwinpthread-1.dll. I remembered that in the video he creates a custom executable in the run configuration and points it to I/bin/krita.exe and that he also added the path created by the env.bat file to the build configuration and that did the trick.

I can now build and run in Qt Creator without a problem, I just need to school myself on the IDE and running the debugger so I can do something useful with my new toys :wink:

Thank you @YRH and @freyalupen for all the help, I really, really, really appreciate it :krita_smile:

3 Likes

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.