Skip to content

[navmap_rviz_plugin] Compilation error when Qt6 is present #8

@Butakus

Description

@Butakus

When building in rolling with an updated Ubuntu 24.04 machine, I am getting the following error:

--- stderr: navmap_rviz_plugin                                                                                               
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreVersionlessTargets.cmake:42 (message):
  Some (but not all) targets in this export set were already defined.

  Targets Defined: Qt::Core

  Targets not yet defined: Qt::CorePrivate

Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreConfig.cmake:65 (include)
  /usr/share/cmake-3.28/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  /usr/lib/x86_64-linux-gnu/cmake/Qt6/QtPublicDependencyHelpers.cmake:108 (find_dependency)
  /usr/lib/x86_64-linux-gnu/cmake/Qt6Widgets/Qt6WidgetsDependencies.cmake:39 (_qt_internal_find_qt_dependencies)
  /usr/lib/x86_64-linux-gnu/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake:50 (include)
  /usr/lib/x86_64-linux-gnu/cmake/Qt6/Qt6Config.cmake:167 (find_package)
  /opt/ros/rolling/share/rviz_common/cmake/rviz_common-extras.cmake:34 (find_package)
  /opt/ros/rolling/share/rviz_common/cmake/rviz_commonConfig.cmake:41 (include)
  CMakeLists.txt:11 (find_package)

I have both Qt5 and Qt6 installed, but it looks like rviz_common is finding Qt6, which conflicts with the find_package(Qt5 ...) in the plugin's CMakeLists.txt.

I think this is related to ros-navigation/navigation2#5570 and ros2/rviz#1187. I tried to apply the same fix as in nav2, but was unable to make it work.

I was able to replicate this in one of my computers and inside a docker container. However, I have another machine with Ubuntu 24.04 where it builds fine (same library versions)...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions