Error Messages, Qt6, Qt6Widget

Hello.
I am posting a screenshot showing persistent error message that I do not understand.
I have read many articles and have used GPT-4 (which has been very helpful in most ways) but my problem is that there are many error messages all seeming to point to the same problem and I’m unable to guess how to make keywords to get the information I need. I also barely understand the nature of the problem so I don’t know what to ask.
I’m getting a lot of basic information which isn’t much better than what I get when I click on one of the links that takes me to where there is a problem in a .cmake file, but I’m not understanding the nature of it, or what code I specifically need to type, and where, and exactly why.
I don’t need to be pointed to textbooks or articles or given generic advice about what needs to be done. At this point I need to be shown the code to write, and where to put it.


Thank you in advance for any detailed, patiently-explained advice.
Cheers
OldFangle

If, having nothing but a picture of a text, I had to guess, then I’d say that probably something is wrong with your Qt installation/build or/and with the way you are telling CMake to find it.

But in general, for someone refusing to get “basic information” and “generic advices”, you provided a rather non-detailed (or actually non-existent) description of your environment and in particular your project.

So here’s how I would look for Qt from my generic project in a generic environment:

# might be an overkill with all these components, just Widgets should be enough
find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED)
target_link_libraries(SOME_TARGET_OF_MINE
    PRIVATE
        Qt6::Core
        Qt6::Gui
        Qt6::Widgets
)

and then here’s how I would configure my project:

$ cd /path/to/project
$ mkdir build && cd build
$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/path/to/qt" ..

I mean, at the very least you could’ve provided a minimal project archive so others could take a look at it and probably try to reproduce your problem (as it might be a bug in Qt’s configs, that wouldn’t be unheard of).

Thanks for the fast response!

Yup, definitely something wrong with the way CMake is trying to find Qt6Widget, and it’s pointing to several places in CMake where ‘something’ needs to be put, but it’s not saying what, or why, or how.

I did a custom build from the Qt website to my Linux Mint (Cinnamon) system, build-essential and libgl1 (mesa-dev) dependencies are present. (Apt- was up-to-date.)

CMake keeps generating these same error messages and I don’t know what they mean. It’s marking the Widgets “not found” but I don’t know what that means, or what needs to be done to make them ‘found’.

Cheers

OF

It usually also prints something like “Reason given by package: HERE-GOES-SOME-REASONING”, but there is none of that on your screenshot (could be that it is not the full output there).

Perhaps you could try to surround find_package() with a debug helper:

set(CMAKE_FIND_DEBUG_MODE 1)
find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED)
set(CMAKE_FIND_DEBUG_MODE 0)

and check the paths it will print out.

It also appears that you are using CMake 3.16, so I would perhaps try with a newer version, just in case.

And you still haven’t shared what configuration arguments/options are set for CMake to configure your project.
Not to mention that minimal version of a project, which one could use to try to reproduce your problem.

Great! Thank you very much, I didn’t know about the “Debug” method, as you’re showing it here.

Yes, that’s all there was in the “Issues” window, nothing was cropped-out of the screenshot. I’m wondering if I didn’t understand a better way of installing Qt in the first place… If there should be more explanation in the Issues window I guess I did something wrong, missed something, along the way…

I’ll remember to check for a more recent version of CMake.

I’m new enough that I’ll have to look up “configuration options” to be sure what that is before I answer that.

I’m working with Qt6, nothing newer.

Thanks again.

OF

If there should be more explanation in the Issues window I guess I did something wrong

It is possible that this really is the entire output, but just to eliminate the possibility of IDE messing things up I would try to configure the project from a bare CLI, like I showed it in my first reply.

I’ll have to look up “configuration options” to be sure what that is

What I meant is that someone runs CMake, right, so that someone needs to provide certain configuration arguments/options to CMake. In your case it is likely IDE who’s doing that, so once again I would recommend you to try to configure your project from a bare CLI, in order to exclude IDE’s shenanigans from the equation.

Looking at you screenshot, that IDE seems to be Qt Creator, and if so, then you can check what arguments it provided to CMake by openning a different output pane, which is called “General Messages”. But that won’t be very helpful, as it doesn’t print everything there, and the full(?) list of options can be found in the Build Settings window under the CMake section. But still, first I would make sure that the project configures fine without IDE.

I’m working with Qt6, nothing newer

There are no newer Qt versions than 6.x. I was talking about CMake version.

Update. I wasn’t able to get an explanation for the problem so I re-installed Qt6 and this time I’m not getting the error message when I first create a Widgets Project. I don’t know what I did that was different the first time.
I got useful information from your messages, Retif, so thanks for your time and help.

1 Like