0

How can I debug this cmake issue to find out why a build works fine on one PC but fails on another?

On both PCs I cloned a repository as follows:

git clone --recurse-submodules https://github.com/iEvgeny/cctv-viewer.git

On first PC my cmake command runs perfectly. On second PC I get this:


cmake ../cctv-viewer -DCMAKE_INSTALL_PREFIX=/usr/local --debug-find-pkg=Qt6QuickCompiler -DQT_DEBUG_FIND_PACKAGE=ON
Running with debug output on for the 'find' commands for package(s) Qt6QuickCompiler.
-- Could NOT find Qt6QuickCompiler (missing: Qt6QuickCompiler_DIR)
CMake Debug Log at /usr/lib/x86_64-linux-gnu/cmake/Qt6/Qt6Config.cmake:167 (find_package):
  The internally managed CMAKE_FIND_PACKAGE_REDIRECTS_DIR.

    /home/scg/Dev/cctv-viewer_build/CMakeFiles/pkgRedirects

  Paths specified by the find_package HINTS option.

    none

  Paths specified by the find_package PATHS option.

    /usr/lib/x86_64-linux-gnu/cmake

  find_package considered the following locations for Qt6QuickCompiler's
  Config module:

    /home/scg/Dev/cctv-viewer_build/CMakeFiles/pkgRedirects/Qt6QuickCompilerConfig.cmake
    /home/scg/Dev/cctv-viewer_build/CMakeFiles/pkgRedirects/qt6quickcompiler-config.cmake
    /usr/lib/x86_64-linux-gnu/cmake/Qt6QuickCompilerConfig.cmake
    /usr/lib/x86_64-linux-gnu/cmake/qt6quickcompiler-config.cmake

  The file was not found.

Call Stack (most recent call first):
  CMakeLists.txt:140 (find_package)


CMake Error at CMakeLists.txt:140 (find_package):
  Found package configuration file:

    /usr/lib/x86_64-linux-gnu/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 "QuickCompiler".

  Expected Config file at
  "/usr/lib/x86_64-linux-gnu/cmake/Qt6QuickCompiler/Qt6QuickCompilerConfig.cmake"
  does NOT exist



  Configuring with --debug-find-pkg=Qt6QuickCompiler might reveal details why
  the package was not found.

   find_package search path values and other context for the last package that was not found:
    CMAKE_MODULE_PATH: /usr/lib/x86_64-linux-gnu/cmake/Qt6;/usr/lib/x86_64-linux-gnu/cmake/Qt6/3rdparty/extra-cmake-modules/find-modules;/usr/lib/x86_64-linux-gnu/cmake/Qt6/3rdparty/kwin;/usr/lib/x86_64-linux-gnu/cmake/Qt6;/usr/lib/x86_64-linux-gnu/cmake/Qt6/3rdparty/extra-cmake-modules/find-modules;/usr/lib/x86_64-linux-gnu/cmake/Qt6/3rdparty/kwin
    CMAKE_PREFIX_PATH: 
    $ENV{CMAKE_PREFIX_PATH}: 
    CMAKE_FIND_ROOT_PATH: 
    _qt_additional_packages_prefix_paths: 
    _qt_additional_host_packages_prefix_paths: 
    _qt_cmake_dir: /usr/lib/x86_64-linux-gnu/cmake
    QT_HOST_PATH: 
    Qt6HostInfo_DIR: 
    Qt6_DIR: /usr/lib/x86_64-linux-gnu/cmake/Qt6
    CMAKE_TOOLCHAIN_FILE: /usr/lib/qt6/bin/../../x86_64-linux-gnu/cmake/Qt6/qt.toolchain.cmake
    CMAKE_FIND_ROOT_PATH_MODE_PACKAGE: 
    CMAKE_SYSROOT: 
    $ENV{PATH}: /home/scg/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

From first glance at the the messages it would seem simple that the second PC is just missing QT6 QuickCompiler but I think the message is a bit confusing as on the first PC there is no such /usr/lib/x86_64-linux-gnu/cmake/Qt6QuickCompiler either, so I don't think it's that.

Both PCs I have installed various QT5 and QT6 prerequisite packages, I have compared the list of all sorts of qt and related packages between the two PCs and it all looks the same but something is obviously different. And I am now stuck with knowing how to identify the difference/s.

On the first PC it seems cmake is finding the correct QT5 and QT6 packages during the build but on the second PC it's not, despite having installed all the same QT5 and QT6 packages.

Both PCs are running Ubuntu 24.04.3 LTS

EDIT: This question was closed and I was asked to provide the following: The desired behavior I would like the cmake command to work successfully on both PCs. I want to find out why it does not work on one PC despite seemingly both PCs having the same QT5/QT6 packages installed.

A specific problem or error I already provided that - the cmake error from the PC where the build does not work.

The shortest code necessary to reproduce the problem I already provided that - a git clone command followed by a cmake. Of course it's not 100% reproducible as my entire problem is that it builds o.k. on one PC but fails on another.

5
  • 1
    stackoverflow.com/a/75701905/11107541 Commented Sep 17 at 20:21
  • 1
    Would find_package(Qt6QuickCompiler) succeed, CMake sets cache variable Qt6QuickCompiler_DIR to the directory with its config script. So you may check that variable on your first PC (cache variables are stored in CMakeCache.txt file in the build directory). Commented Sep 17 at 20:36
  • @Tsyvarev I don't think there is any such package, if I do a Ubuntu package search for QuickCompiler then it only comes back with QT5QuickCompiler. In the make file it has this line where it looks for Qt6 and Qt5 packages: find_package(QT NAMES Qt6 Qt5 COMPONENTS ${QT_LINK_DEPENDENCIES} QuickCompiler LinguistTools REQUIRED) On the working PC QT_VERSION_MAJOR is 5 after that, but on the non-working PC it is 6. Despite both PCs having QT5 and QT6 packages. So I think that is the key here. I can at least work around this now by just removing Qt6 from that makefile line... Commented Sep 18 at 7:20
  • Ok, so you have been able to handle the problem by yourself. As for closed state of your question - no, your edit doesn't fix the close reason. We see the ouput from the second PC, and the failing reason is clear. But we don't have the output from the first PC to examine why it succeed. And your vague descriptions about similarities of installed packages on both PCs are not helpful. All you needed was to check that output and find out that on the first PC CMake has found QT5, not a QT6. Commented Sep 18 at 8:39
  • This is just another example of non-succeeded question "Why it works on that PC and don't work on another". Instead, it is better to focus on debugging the fail itself. The configuration has failed to find QuickCompiler component for QT6? - Just install it. Or find out, that your QT5 installation has that component, so your next question will be "how to tell CMake to search for QT5 instead of QT6?". Commented Sep 18 at 8:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.