Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cmake does not find QtQuick even if it's installed

I installed Qt 6.2.0 with the online installer and selected most of the module for Desktop development. I get this strange message:

/home/user/Qt/Examples/Qt-6.2.0/multimedia/video/mediaplayer/CMakeLists.txt:28: error: Found package configuration file: /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6/Qt6Config.cmake but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT FOUND.  Reason given by package: Failed to find Qt component "Quick". Expected Config file at "/home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake" exists

English is not my primary language, and I'm not sure what the last sentence really means:

"Expected Config file at <path> exists"

Actually the file exists:

$ ls /home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake 
/home/user/Qt/6.2.0/gcc_64/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake

I don't understand why it don't find QtQuick and then I don't know how to fix it...

like image 587
Mark Avatar asked Sep 18 '25 21:09

Mark


2 Answers

I had to install the qt6-declarative-dev package for Qt Creator in Ubuntu to pick this up automatically. After that, it worked out of the box.

like image 150
Squinky86 Avatar answered Sep 21 '25 13:09

Squinky86


Failed to find Qt component "Quick".

see the file lib/cmake/Qt6Quick/Qt6QuickTargets.cmake

the variable _IMPORT_PREFIX tells cmake
where to find the include/ and lib/ files for QtQuick

usually its the parent-parent-parent folder of the cmake file
so /home/user/Qt/6.2.0/gcc_64 in your case

for debugging, add this to Qt6QuickTargets.cmake

get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
# ...

message("debug: _IMPORT_PREFIX = ${_IMPORT_PREFIX}")

the file libQt6Quick.so should be in the _IMPORT_PREFIX path

otherwise find it by

cd /home/user/Qt/6.2.0/gcc_64
find . -name 'libQt6Quick.so*'

related:
the environment variable QT_ADDITIONAL_PACKAGES_PREFIX_PATH
helps qt to find the lib/cmake/Qt6(modulename)/Qt6(modulename)Targets.cmake files

like image 38
Mila Nautikus Avatar answered Sep 21 '25 15:09

Mila Nautikus