Skip to content

Fix navmap_rviz_plugin build with Qt5 rviz_common and Qt6 installed - #44

Open
Butakus wants to merge 1 commit into
EasyNavigation:rollingfrom
Butakus:fix_qt5_qt6
Open

Butakus wants to merge 1 commit into
EasyNavigation:rollingfrom
Butakus:fix_qt5_qt6

Conversation

@Butakus

@Butakus Butakus commented Nov 4, 2026

Copy link
Copy Markdown
Member

Hi, it seems the Qt5/Qt6 issue is never resolved...

On Ubuntu 24.04, navmap_rviz_plugin fails to configure when the Qt6 development files are installed:

CMake Error at /opt/ros/rolling/share/rviz_common/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package):
  Found package configuration file:
    /usr/lib/x86_64-linux-gnu/cmake/Qt5/Qt5Config.cmake
  but it set Qt5_FOUND to FALSE so package "Qt5" is considered to be NOT FOUND.
  Reason given by package:
  The Qt5 package requires at least one component

rviz_common 15.2.2 is built against Qt5, but its rviz_common-extras.cmake looks for Qt6 first and only falls back to Qt5 if Qt6 is missing. With Qt6 installed, Qt5 is never loaded, and the exported-dependencies step then runs a bare find_package(Qt5), which fails.

The existing Qt detection that we have in the CMakeLists.txt for the plugin (get_target_property on rviz_common::rviz_common) runs after find_package(rviz_common), so CMake never reaches it. CMake aborts with an error when calling find_package(rviz_common).

Fix

Before find_package(rviz_common), read rviz_common's exported dependencies to work out whether it uses Qt5 or Qt6:

  • set qt_major, which is used for find_package(Qt${qt_major} ...) and linking, as before;
  • when rviz uses Qt5, set CMAKE_DISABLE_FIND_PACKAGE_Qt6 so rviz's extras don't pick up Qt6.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant