Installed Qt6.8.2 - now cmake cannot find Qt6 components
-
I install Qt with the online installer. I build my Qt6 app with cmake, on ubuntu 22.04.3. My CMakeLists.txt:
find_package(Qt6 COMPONENTS Gui Quick REQUIRED)
Previously I built successfully with Qt6.8.0
I just installed Qt6.8.2 with the online installer, into directory /home/oreilly/Qt6.8. Now my cmake file fails to find Qt6 components - Grrrr... What am I doing wrong?
Thanks!By not providing "FindQt6QmlTools.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt6QmlTools", but CMake did not find one. Could not find a package configuration file provided by "Qt6QmlTools" (requested version 6.8.0) with any of the following names: Qt6QmlToolsConfig.cmake qt6qmltools-config.cmake Add the installation prefix of "Qt6QmlTools" to CMAKE_PREFIX_PATH or set "Qt6QmlTools_DIR" to a directory containing one of the above files. If "Qt6QmlTools" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6QuickTools/Qt6QuickToolsDependencies.cmake:12 (find_dependency) /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6QuickTools/Qt6QuickToolsConfig.cmake:36 (include) /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:97 (find_package) /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Quick/Qt6QuickDependencies.cmake:38 (_qt_internal_find_tool_dependencies) /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake:43 (include) /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6/Qt6Config.cmake:181 (find_package) src/qt-guilib/CMakeLists.txt:25 (find_package) CMake Warning at /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:97 (find_package): Found package configuration file: /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6QuickTools/Qt6QuickToolsConfig.cmake but it set Qt6QuickTools_FOUND to FALSE so package "Qt6QuickTools" is considered to be NOT FOUND. Reason given by package: Qt6QuickTools could not be found because dependency Qt6QmlTools could not be found. Call Stack (most recent call first): /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Quick/Qt6QuickDependencies.cmake:38 (_qt_internal_find_tool_dependencies) /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake:43 (include) /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6/Qt6Config.cmake:181 (find_package) src/qt-guilib/CMakeLists.txt:25 (find_package) CMake Warning at /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6/Qt6Config.cmake:181 (find_package): Found package configuration file: /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake but it set Qt6Quick_FOUND to FALSE so package "Qt6Quick" is considered to be NOT FOUND. Reason given by package: Qt6Quick could not be found because dependency Qt6QuickTools could not be found. Configuring with --debug-find-pkg=Qt6QuickTools might reveal details why the package was not found. Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some of the path variables that find_package uses to try and find the package. Call Stack (most recent call first): src/qt-guilib/CMakeLists.txt:25 (find_package) CMake Error at src/qt-guilib/CMakeLists.txt:25 (find_package): Found package configuration file: /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/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 required Qt component "Quick". Expected Config file at "/home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Quick/Qt6QuickConfig.cmake" exists
-
OK I was using online-installer and MaintenanceTool incorrectly. For my own edification/notes, the "correct" way for Qt desktop seems to be:
- Run installer, specify "Qt" as Qt destination directory, then specify "Qt 6.8 for desktop development"
- Run downloaded Qt/MaintenanceTool , select Add or remove components
Qt->Qt6.8.2->Additional libraries->Qt Graphs (plus preselected libraries)
Thanks for your help everyone.
-
Hi,
Any chances you have a cache lying around from the previous build ?
-
@SGaist - I removed the cache file, problem still persists. cmake output says:
Found package configuration file: /home/oreilly/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/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 required Qt component "Quick".
Why is component "Quick" not found? Is it not installed by default by the online installer?
-
Wait...
Why is it searching in Design Studio ?
Are you sure the kit you are trying to use is pointing to the Qt 6.8.2 that you installed ? -
No, you should have stopped at the cmake level.
-
But now I want to add Graphs component:
find_package(Qt6 COMPONENTS Gui Quick Graphs REQUIRED)
But cmake fails:
-- Could NOT find Qt6Graph (missing: Qt6Graph_DIR) CMake Error at src/qt-guilib/CMakeLists.txt:25 (find_package): Found package configuration file: /home/oreilly/Qt6.8/6.8.2/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 required Qt component "Graph". Expected Config file at "/home/oreilly/Qt6.8/6.8.2/gcc_64/lib/cmake/Qt6Graph/Qt6GraphConfig.cmake" does NOT exist
I looked in the online installer, didn't see any "custom" installation for Graphs - How can I install it?
Thanks!
-
There's something wrong somewhere. Your components show graphs yet cmake is warning about graph. Did you forget the s in your
CMakeLists.txt
? -
@SGaist
I tried both "Graph" and "Graphs" - here is output from "Graphs":Found package configuration file: /home/oreilly/Qt6.8/6.8.2/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 required Qt component "Graphs". Expected Config file at "/home/oreilly/Qt6.8/6.8.2/gcc_64/lib/cmake/Qt6Graphs/Qt6GraphsConfig.cmake" does NOT exist
-
The problem is that in Qt 6.8.2, the Graphs headers, cmake and libraries components are only found in the Tools/QtDesignStudio directory; e.g. on my system in $HOME/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version. But I do not use QtDesignStudio as I've found it to be very buggy in ubuntu 22.04.3.
It's a pain-in-the-neck but I had to manually create symbolic links in order to build with Qt6 Graphs on my system:ln -s ~/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/cmake/Qt6Graphs ~/Qt6.8/6.8.2/gcc_64/lib/Qt6Graphs ln -s ~/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/lib/libQt6Graphs.so.6.8.0 ~/Qt6.8/6.8.2/gcc_64/lib/libQt6Graphs.so.6.8.0 ln -s ~/Qt6.8/Tools/QtDesignStudio/qt6_design_studio_reduced_version/include/QtGraphs ~/Qt6.8/6.8.2/gcc_64/include/QtGraphs
Perhaps I could avoid making these symbolic links through clever use of environment variables, but the above seems to work now.
I assume and hope that the Graphs components will be moved from Tools/QtDesignStudio into the "standard" directory (e.g 6.8.x/) in future releases.
-
Almost there...
I add the following to my app's qml file as described here:import QtGraphs
I build my app with cmake as described above but when I run it, it generates an error and segfaults:
module "QtGraphs" is not installed Segmentation fault (core dumped)
What am I missing now?
Thanks! -
Did you check that you installed the optional components in the installer ?
-
@SGaist - I selected "Qt 6.8 for desktop development" in the online installer. As noted above the downloaded components included Qt Graphs code and libraries under the Tools/QtDesignStudio/ directory - I had to make some symbolic links to those in order to build my code (I do not use QtDesignStudio). I can compile and link my application, but "import QtGraphs" fails at runtime. Where are the "optional components" you refer to? If I select "Custom Installation" instead of "Qt 6.8 for desktop development" I don't see options obviously related to Qt Graphs.
-
@Tom-asso said in Installed Qt6.8.2 - now cmake cannot find Qt6 components:
I had to make some symbolic links to those in order to build my code (I do not use QtDesignStudio)
This is wrong Qt modules are not installed in Tools/QtDesignStudio!
"Where are the "optional components" you refer to?" - in the Qt installer or Qt maintenance tool. -
OK I was using online-installer and MaintenanceTool incorrectly. For my own edification/notes, the "correct" way for Qt desktop seems to be:
- Run installer, specify "Qt" as Qt destination directory, then specify "Qt 6.8 for desktop development"
- Run downloaded Qt/MaintenanceTool , select Add or remove components
Qt->Qt6.8.2->Additional libraries->Qt Graphs (plus preselected libraries)
Thanks for your help everyone.
-
T Tom asso has marked this topic as solved