Skip to content

Use qt6 as the default dependency from rosdep - #1635

Merged
ahcorde merged 1 commit into
rollingfrom
ahcorde/rolling/qt6_default
Dec 8, 2025
Merged

ahcorde merged 1 commit into
rollingfrom
ahcorde/rolling/qt6_default

Conversation

@ahcorde

@ahcorde ahcorde commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

Related with #1634

Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
@ahcorde

ahcorde commented Dec 3, 2025

Copy link
Copy Markdown
Contributor Author

Related PR ros/rosdistro#48855 to bring svg devel package

@luca-della-vedova luca-della-vedova left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you for the fix!

For reference, I believe the issue was that we export Qt5 as a dependency and call find_package on it:

$ cat /opt/ros/rolling/share/rviz_common/cmake/ament_cmake_export_dependencies-extras.cmake 
# generated from ament_cmake_export_dependencies/cmake/ament_cmake_export_dependencies-extras.cmake.in

set(_exported_dependencies "geometry_msgs;message_filters;pluginlib;Qt5;rclcpp;rviz_ogre_vendor;rviz_rendering;sensor_msgs;std_msgs;std_srvs;tf2;tf2_ros;yaml_cpp_vendor;yaml-cpp")

But on the other hand we find_package for either Qt6 or Qt5, whichever is found first:

$ cat /opt/ros/rolling/share/rviz_common/cmake/rviz_common-extras.cmake 
# find package Qt5 because otherwise using the rviz_common::rviz_common
# exported target will complain that the Qt5::Widgets target does not exist
find_package(QT NAMES Qt6 Qt5 QUIET COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS Widgets)

So if Qt6 is installed we end up with a clash where we find both Qt6 and Qt5 and that doesn't really work.
On the other hand, with this PR, the ament_cmake_export_dependencies-extras.cmake becomes the following:

$ cat install/rviz_common/share/rviz_common/cmake/ament_cmake_export_dependencies-extras.cmake 
# generated from ament_cmake_export_dependencies/cmake/ament_cmake_export_dependencies-extras.cmake.in

set(_exported_dependencies "geometry_msgs;message_filters;pluginlib;Qt6;rclcpp;rviz_ogre_vendor;rviz_rendering;sensor_msgs;std_msgs;std_srvs;tf2;tf2_ros;yaml_cpp_vendor;yaml-cpp")

So we will correctly only look for Qt6 (and possibly fallback to Qt5, but I haven't tested that code path).
I wonder if it is an explicit aim to keep supporting Qt5 or not, I haven't tested that path

@ahcorde

ahcorde commented Dec 5, 2025

Copy link
Copy Markdown
Contributor Author

Pulls: #1635
Gist: https://gist.githubusercontent.com/ahcorde/276dbe5df396bdb03ee1f73df82916f5/raw/899c6b81bdd8c422402daf88ae2dac0d8b7a1c91/ros2.repos
BUILD args: --packages-above-and-dependencies rviz2 rviz_common rviz_default_plugins rviz_rendering rviz_rendering_tests rviz_visual_testing_framework
TEST args: --packages-above rviz2 rviz_common rviz_default_plugins rviz_rendering rviz_rendering_tests rviz_visual_testing_framework
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/17698

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@ahcorde

ahcorde commented Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

@ros-pull-request-builder retest this please

1 similar comment
@ahcorde

ahcorde commented Dec 8, 2025

Copy link
Copy Markdown
Contributor Author

@ros-pull-request-builder retest this please

@ahcorde
ahcorde merged commit 4784c8c into rolling Dec 8, 2025
@ahcorde
ahcorde deleted the ahcorde/rolling/qt6_default branch December 8, 2025 17:10
@miguelgonrod

Copy link
Copy Markdown
Contributor

Hi @ahcorde, I'm not sure but apparently this change broke rolling jobs, as they can't find Qt5::Widgets from rqt_gui_cpp
Status: Build Status

Reference Builds

Log Output

rqt_gui_cpp (stderr)
02:55:31 --- stderr: rqt_gui_cpp
02:55:31 CMake Error at /tmp/ws/install_isolated/qt_gui_cpp/share/qt_gui_cpp/cmake/export_qt_gui_cppExport.cmake:61 (set_target_properties):
02:55:31   The link interface of target "qt_gui_cpp::qt_gui_cpp" contains:
02:55:31 
02:55:31     Qt5::Widgets
02:55:31 
02:55:31   but the target was not found.  Possible reasons include:
02:55:31 
02:55:31     * There is a typo in the target name.
02:55:31     * A find_package call is missing for an IMPORTED target.
02:55:31     * An ALIAS target is missing.
02:55:31 
02:55:31 Call Stack (most recent call first):
02:55:31   /tmp/ws/install_isolated/qt_gui_cpp/share/qt_gui_cpp/cmake/ament_cmake_export_targets-extras.cmake:9 (include)
02:55:31   /tmp/ws/install_isolated/qt_gui_cpp/share/qt_gui_cpp/cmake/qt_gui_cppConfig.cmake:41 (include)
02:55:31   CMakeLists.txt:30 (find_package)
02:55:31 
02:55:31 
02:55:31 CMake Generate step failed.  Build files cannot be regenerated correctly.
02:55:31 ---

@ahcorde

ahcorde commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

@Timple

Timple commented Dec 18, 2025 •

Copy link
Copy Markdown

I also had to do this:

# rviz switched to Qt6: https://github.com/ros2/rviz/pull/1635
if(rviz_common_VERSION_MAJOR GREATER_EQUAL 15 AND rviz_common_VERSION_MINOR GREATER_EQUAL 1)
  find_package(Qt6 COMPONENTS Network REQUIRED)
  set(QT_VERSION_MAJOR 6)
else()
  find_package(Qt5 COMPONENTS Network REQUIRED)
  set(QT_VERSION_MAJOR 5)
endif()
...

target_link_libraries(${PROJECT_NAME} PUBLIC
  proj Qt${QT_VERSION_MAJOR}::Network
  etc

I could not rely on finding Qt6 because a users laptop might have both available.

Timple added a commit to nobleo/rviz_satellite that referenced this pull request Dec 18, 2025
Timple added a commit to nobleo/rviz_satellite that referenced this pull request Dec 18, 2025
Timple added a commit to nobleo/rviz_satellite that referenced this pull request Dec 18, 2025
Timple added a commit to nobleo/rviz_satellite that referenced this pull request Dec 18, 2025
nbbrooks added a commit to nbbrooks/moveit2 that referenced this pull request Mar 22, 2026
…case for Jazzy/Kilted with both Qt6 and Qt5, where Qt5 should be picked.
nbbrooks added a commit to moveit/moveit2 that referenced this pull request Mar 23, 2026
* Adopt QT_VERSION_MAJOR approach used in rvzi2

* Start using <depend> check on ROS_DISTRO to conditionally require qt5 or qt6 depending on ROS_DISTRO

* Explicitly prefer Qt6 when Qt6 and Qt5 are both present to work around the default CMake ascending ordering resolving to Qt5.
- For Rolling, Qt6 should be used if both are present
- For Jazzy and Kilted, Qt5 should be used if both are present, but this will not cover that edge case

* Adopt Timple's approach ros2/rviz#1635 (comment) for supporting edge case for Jazzy/Kilted with both Qt6 and Qt5, where Qt5 should be picked.

* Set QT_DIR to fix transitive dependencies that should resolve to Qt6 but incorrectly resolve to Qt5 due to default cmake order resolution
Kooolkimooov added a commit to Kooolkimooov/mc_rtc_ros that referenced this pull request May 25, 2026
QT6 is default in rviz with ROS Lyrical, see
ros2/rviz#1635
nbbrooks added a commit to PickNikRobotics/rviz_visual_tools that referenced this pull request Aug 2, 2026
Select Qt6 when building against rviz >= 15.1, which is where rviz itself
switched to Qt6 (ros2/rviz#1635); otherwise keep Qt5. On Rolling / Ubuntu
Resolute, Qt5 has been removed from the apt indexes; on humble/jazzy/kilted
the Qt5 path still works. This makes the CMake file build on both without
changing behavior on older distros.

Gate on rviz_common_VERSION rather than on whether Qt6 is installed. An
availability probe (find_package(Qt6 QUIET)) says nothing about which Qt
rviz was built against, and rviz_visual_tools_gui links rviz_common,
rviz_rendering, rviz_default_plugins and rviz_ogre_vendor::OgreMain -- its
Qt must match rviz's or the result is an ABI mismatch. Ubuntu 24.04 ships
both Qt5 and Qt6, so on jazzy/kilted a machine that happens to have
qt6-base-dev present would otherwise silently build Qt6 against a Qt5 rviz.

Distro alignment (rosdistro, 2026-08-02):
  humble  rviz 11.2.28 -> Qt5    lyrical rviz 15.2.5 -> Qt6
  jazzy   rviz 14.1.23 -> Qt5    rolling rviz 16.0.2 -> Qt6
  kilted  rviz 15.0.14 -> Qt5

Mirrors the approach taken in moveit/moveit2#3707, including the QT_DIR
hint for transitive deps whose find_package(QT NAMES Qt6 Qt5 ...) can
mis-resolve to Qt5 under CMake's ascending path order.

No source-side Qt6 changes are needed here: this package has no .ui files
and none of the Qt5-only API patterns moveit2 had to fix -- only plain
widget includes, Q_OBJECT, QCursor and Qt::Key_N enums, all unchanged
in Qt6.

Validated by source-build on ubuntu:resolute + ROS Rolling
(ros2-testing apt).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to PickNikRobotics/rviz_visual_tools that referenced this pull request Aug 2, 2026
Select Qt6 when building against rviz >= 15.1.14, which is the release where
rviz itself switched to Qt6; otherwise keep Qt5. On Rolling / Ubuntu Resolute,
Qt5 has been removed from the apt indexes; on humble/jazzy/kilted the Qt5 path
still works. This makes the CMake file build on both without changing behavior
on older distros.

The Qt6 switch is ros2/rviz#1635 "Use qt6 as the default dependency from
rosdep" (ahcorde, merged 2025-12-08, commit 4784c8cd), which flipped
rviz_common's package.xml from qtbase5-dev/libqt5-* to qt6-base-dev/libqt6-*.
It first shipped in rviz 15.1.14 (tagged 2025-12-17) -- note 15.1.0 through
15.1.13 are still Qt5, so the threshold is 15.1.14 and not 15.1.

Gate on rviz_common_VERSION rather than on whether Qt6 is installed. An
availability probe (find_package(Qt6 QUIET)) says nothing about which Qt rviz
was built against, and rviz_visual_tools_gui links rviz_common, rviz_rendering,
rviz_default_plugins and rviz_ogre_vendor::OgreMain, so its Qt must match
rviz's. Concretely, on a jazzy or kilted machine that also has qt6-base-dev
installed, the availability probe does not silently mis-select -- it aborts
the configure outright, because rviz_common has already defined the versionless
Qt::Core target:

  CMake Error at Qt6CoreVersionlessTargets.cmake:42:
    Some (but not all) targets in this export set were already defined.
    Targets Defined: Qt::Core
    Targets not yet defined: Qt::CorePrivate

QUIET does not suppress that -- it is a FATAL_ERROR inside Qt6's own config,
not a not-found condition, so the Qt5 fallback is never reached.

Validated in osrf/ros:<distro>-desktop containers, comparing the gate's choice
against objdump of librviz_common.so:

  distro   rviz_common  gate  rviz links
  humble   11.2.26      Qt5   libQt5Core
  jazzy    14.1.22      Qt5   libQt5Core
  kilted   15.0.13      Qt5   libQt5Core
  lyrical  15.2.4       Qt6   libQt6Core
  rolling  16.0.1       Qt6   libQt6Core

Also verified that with qt6-base-dev additionally installed on jazzy and
kilted, this gate still selects Qt5 and configures cleanly.

Mirrors the approach taken in moveit/moveit2#3707, including the QT_DIR hint
for transitive deps whose find_package(QT NAMES Qt6 Qt5 ...) can mis-resolve
to Qt5 under CMake's ascending path order.

No source-side Qt6 changes are needed here: this package has no .ui files and
none of the Qt5-only API patterns moveit2 had to fix -- only plain widget
includes, Q_OBJECT, QCursor and Qt::Key_N enums, all unchanged in Qt6.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to moveit/moveit2 that referenced this pull request Aug 2, 2026
The Qt6 gates added in #3707 test `rviz2_VERSION VERSION_GREATER_EQUAL 15.1`,
but rviz did not switch to Qt6 at 15.1.0. ros2/rviz#1635 ("Use qt6 as the
default dependency from rosdep", ahcorde, merged 2025-12-08, commit 4784c8cd)
first shipped in the 15.1.14 tag on 2025-12-17. Bisecting rviz_common's
package.xml:

  15.1.11  qtbase5-dev
  15.1.12  qtbase5-dev
  15.1.13  qtbase5-dev
  15.1.14  qt6-base-dev   <- switch

So 15.1.0 through 15.1.13 are Qt5 but are currently classified as Qt6. Any
build against an rviz in that window picks Qt6 while rviz itself is Qt5.

No active distro sits in that window today (humble 11.2.x, jazzy 14.1.x,
kilted 15.0.x are Qt5; lyrical 15.2.x and rolling 16.0.x are Qt6), so this is
latent rather than currently breaking -- but kilted is at 15.0.13, one patch
series below the bad range.

Applied to all 8 CMakeLists.txt carrying the gate (moveit_ros/visualization
plus the 7 moveit_setup_assistant packages).

Verified in osrf/ros:<distro>-desktop containers that rviz2_VERSION and
rviz_common_VERSION agree and that the corrected gate still resolves
correctly: kilted 15.0.13 -> Qt5, lyrical 15.2.4 -> Qt6, rolling 16.0.1 -> Qt6.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to PickNikRobotics/rviz_visual_tools that referenced this pull request Aug 2, 2026
The CMake change alone is not enough. package.xml still hard-coded Qt5
rosdep keys:

  <build_depend>qtbase5-dev</build_depend>
  <exec_depend>libqt5-widgets</exec_depend>

Those resolve to Qt5 packages on every platform, including Resolute where
Qt5 has been removed from the apt indexes. So rosdep would fail to install
the build dependency, or install Qt5 while CMake goes looking for Qt6 --
either way the package does not build on Resolute even with the corrected
CMake gate.

Switch to the versionless keys, which rosdep maps per-platform. This is the
same move ros2/rviz#1635 made in rviz_common's package.xml:

  key             jammy           noble               * (resolute)
  qt-base-dev     qtbase5-dev     qtbase5-dev         qt6-base-dev
  libqtwidgets    libqt5widgets5  libqt5widgets5t64   libqt6widgets6

That mapping agrees with the CMake gate on all five distros:

  humble  (jammy)    rviz 11.2  -> Qt5, rosdep installs Qt5
  jazzy   (noble)    rviz 14.1  -> Qt5, rosdep installs Qt5
  kilted  (noble)    rviz 15.0  -> Qt5, rosdep installs Qt5
  lyrical (resolute) rviz 15.2  -> Qt6, rosdep installs Qt6
  rolling (resolute) rviz 16.0  -> Qt6, rosdep installs Qt6

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to PickNikRobotics/rviz_visual_tools that referenced this pull request Aug 2, 2026
Select Qt6 when building against rviz >= 15.1.14, which is the release where
rviz itself switched to Qt6; otherwise keep Qt5.

On Rolling / Ubuntu Resolute, rviz is built against Qt6, so this package's
unconditional find_package(Qt5 REQUIRED COMPONENTS Widgets) collides with it
and CMake refuses to generate at all:

  CMake Error: The INTERFACE_QT_MAJOR_VERSION property of "Qt5::Core" does
  not agree with the value of QT_MAJOR_VERSION already determined
  CMake Generate step failed.  Build files cannot be regenerated correctly.

Note the problem is the Qt5/Qt6 *mix*, not Qt5 being unavailable: Qt5 is
still perfectly installable on Resolute (CI shows apt-get install qtbase5-dev
pulling qt5-qmake-bin 5.15.18+dfsg-1ubuntu1). Availability is therefore the
wrong thing to gate on -- see below.

The Qt6 switch is ros2/rviz#1635 "Use qt6 as the default dependency from
rosdep" (ahcorde, merged 2025-12-08, commit 4784c8cd), which flipped
rviz_common's package.xml from qtbase5-dev/libqt5-* to qt6-base-dev/libqt6-*.
It first shipped in rviz 15.1.14 (tagged 2025-12-17) -- note 15.1.0 through
15.1.13 are still Qt5, so the threshold is 15.1.14 and not 15.1.

Gate on rviz_common_VERSION rather than on whether Qt6 is installed. An
availability probe (find_package(Qt6 QUIET)) says nothing about which Qt rviz
was built against, and rviz_visual_tools_gui links rviz_common, rviz_rendering,
rviz_default_plugins and rviz_ogre_vendor::OgreMain, so its Qt must match
rviz's. On a jazzy or kilted machine that also has qt6-base-dev installed, the
availability probe does not silently mis-select -- it aborts the configure,
because rviz_common has already defined the versionless Qt::Core target:

  CMake Error at Qt6CoreVersionlessTargets.cmake:42:
    Some (but not all) targets in this export set were already defined.
    Targets Defined: Qt::Core
    Targets not yet defined: Qt::CorePrivate

QUIET does not suppress that -- it is a FATAL_ERROR inside Qt6's own config,
not a not-found condition, so the Qt5 fallback is never reached.

Validated in osrf/ros:<distro>-desktop containers, comparing the gate's choice
against objdump of librviz_common.so:

  distro   rviz_common  gate  rviz links
  humble   11.2.26      Qt5   libQt5Core
  jazzy    14.1.22      Qt5   libQt5Core
  kilted   15.0.13      Qt5   libQt5Core
  lyrical  15.2.4       Qt6   libQt6Core
  rolling  16.0.1       Qt6   libQt6Core

Also verified that with qt6-base-dev additionally installed on jazzy and
kilted, this gate still selects Qt5 and configures cleanly.

Mirrors the approach taken in moveit/moveit2#3707, including the QT_DIR hint
for transitive deps whose find_package(QT NAMES Qt6 Qt5 ...) can mis-resolve
to Qt5 under CMake's ascending path order.

No source-side Qt6 changes are needed here: this package has no .ui files and
none of the Qt5-only API patterns moveit2 had to fix -- only plain widget
includes, Q_OBJECT, QCursor and Qt::Key_N enums, all unchanged in Qt6.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to PickNikRobotics/rviz_visual_tools that referenced this pull request Aug 2, 2026
The CMake change alone is not enough. package.xml still hard-coded Qt5
rosdep keys:

  <build_depend>qtbase5-dev</build_depend>
  <exec_depend>libqt5-widgets</exec_depend>

Those resolve to Qt5 on every platform, so on Resolute rosdep installs Qt5
while CMake needs Qt6 to match rviz -- which is exactly how the
INTERFACE_QT_MAJOR_VERSION collision fixed in the previous commit arises.
CI confirms the sequence: apt-get install qtbase5-dev and libqt5widgets5t64
both succeed on ubuntu:resolute, and the build then fails at generate.

(To be clear, Qt5 has not been removed from Resolute's apt indexes; it
installs fine. It simply must not be mixed with the Qt6 rviz we link.)

Switch to the versionless keys, which rosdep maps per-platform. This is the
same move ros2/rviz#1635 made in rviz_common's package.xml:

  key             jammy           noble               * (resolute)
  qt-base-dev     qtbase5-dev     qtbase5-dev         qt6-base-dev
  libqtwidgets    libqt5widgets5  libqt5widgets5t64   libqt6widgets6

That mapping agrees with the CMake gate on all five distros, so rosdep
installs exactly the Qt that CMake then selects:

  humble  (jammy)    rviz 11.2  -> Qt5
  jazzy   (noble)    rviz 14.1  -> Qt5
  kilted  (noble)    rviz 15.0  -> Qt5
  lyrical (resolute) rviz 15.2  -> Qt6
  rolling (resolute) rviz 16.0  -> Qt6

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to PickNikRobotics/rviz_visual_tools that referenced this pull request Aug 2, 2026
Select Qt6 when building against rviz >= 15.1.14, which is the release where
rviz itself switched to Qt6; otherwise keep Qt5.

On Rolling / Ubuntu Resolute, rviz is built against Qt6, so this package's
unconditional find_package(Qt5 REQUIRED COMPONENTS Widgets) collides with it
and CMake refuses to generate at all:

  CMake Error: The INTERFACE_QT_MAJOR_VERSION property of "Qt5::Core" does
  not agree with the value of QT_MAJOR_VERSION already determined
  CMake Generate step failed.  Build files cannot be regenerated correctly.

Note the problem is the Qt5/Qt6 *mix*, not Qt5 being unavailable: Qt5 is
still perfectly installable on Resolute (CI shows apt-get install qtbase5-dev
pulling qt5-qmake-bin 5.15.18+dfsg-1ubuntu1). Availability is therefore the
wrong thing to gate on -- see below.

The Qt6 switch is ros2/rviz#1635 "Use qt6 as the default dependency from
rosdep" (ahcorde, merged 2025-12-08, commit 4784c8cd), which flipped
rviz_common's package.xml from qtbase5-dev/libqt5-* to qt6-base-dev/libqt6-*.
It first shipped in rviz 15.1.14 (tagged 2025-12-17) -- note 15.1.0 through
15.1.13 are still Qt5, so the threshold is 15.1.14 and not 15.1.

Gate on rviz_common_VERSION rather than on whether Qt6 is installed. An
availability probe (find_package(Qt6 QUIET)) says nothing about which Qt rviz
was built against, and rviz_visual_tools_gui links rviz_common, rviz_rendering,
rviz_default_plugins and rviz_ogre_vendor::OgreMain, so its Qt must match
rviz's. On a jazzy or kilted machine that also has qt6-base-dev installed, the
availability probe does not silently mis-select -- it aborts the configure,
because rviz_common has already defined the versionless Qt::Core target:

  CMake Error at Qt6CoreVersionlessTargets.cmake:42:
    Some (but not all) targets in this export set were already defined.
    Targets Defined: Qt::Core
    Targets not yet defined: Qt::CorePrivate

QUIET does not suppress that -- it is a FATAL_ERROR inside Qt6's own config,
not a not-found condition, so the Qt5 fallback is never reached.

Validated in osrf/ros:<distro>-desktop containers, comparing the gate's choice
against objdump of librviz_common.so:

  distro   rviz_common  gate  rviz links
  humble   11.2.26      Qt5   libQt5Core
  jazzy    14.1.22      Qt5   libQt5Core
  kilted   15.0.13      Qt5   libQt5Core
  lyrical  15.2.4       Qt6   libQt6Core
  rolling  16.0.1       Qt6   libQt6Core

Also verified that with qt6-base-dev additionally installed on jazzy and
kilted, this gate still selects Qt5 and configures cleanly.

Mirrors the approach taken in moveit/moveit2#3707, including the QT_DIR hint
for transitive deps whose find_package(QT NAMES Qt6 Qt5 ...) can mis-resolve
to Qt5 under CMake's ascending path order.

No source-side Qt6 changes are needed here: this package has no .ui files and
none of the Qt5-only API patterns moveit2 had to fix -- only plain widget
includes, Q_OBJECT, QCursor and Qt::Key_N enums, all unchanged in Qt6.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to PickNikRobotics/rviz_visual_tools that referenced this pull request Aug 2, 2026
The CMake change alone is not enough. package.xml still hard-coded Qt5
rosdep keys:

  <build_depend>qtbase5-dev</build_depend>
  <exec_depend>libqt5-widgets</exec_depend>

Those resolve to Qt5 on every platform, so on Resolute rosdep installs Qt5
while CMake needs Qt6 to match rviz -- which is exactly how the
INTERFACE_QT_MAJOR_VERSION collision fixed in the previous commit arises.
CI confirms the sequence: apt-get install qtbase5-dev and libqt5widgets5t64
both succeed on ubuntu:resolute, and the build then fails at generate.

(To be clear, Qt5 has not been removed from Resolute's apt indexes; it
installs fine. It simply must not be mixed with the Qt6 rviz we link.)

Switch to the versionless keys, which rosdep maps per-platform. This is the
same move ros2/rviz#1635 made in rviz_common's package.xml:

  key             jammy           noble               * (resolute)
  qt-base-dev     qtbase5-dev     qtbase5-dev         qt6-base-dev
  libqtwidgets    libqt5widgets5  libqt5widgets5t64   libqt6widgets6

That mapping agrees with the CMake gate on all five distros, so rosdep
installs exactly the Qt that CMake then selects:

  humble  (jammy)    rviz 11.2  -> Qt5
  jazzy   (noble)    rviz 14.1  -> Qt5
  kilted  (noble)    rviz 15.0  -> Qt5
  lyrical (resolute) rviz 15.2  -> Qt6
  rolling (resolute) rviz 16.0  -> Qt6

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to PickNikRobotics/rviz_visual_tools that referenced this pull request Aug 2, 2026
* CMakeLists: dual-support Qt5 and Qt6

Select Qt6 when building against rviz >= 15.1.14, which is the release where
rviz itself switched to Qt6; otherwise keep Qt5.

On Rolling / Ubuntu Resolute, rviz is built against Qt6, so this package's
unconditional find_package(Qt5 REQUIRED COMPONENTS Widgets) collides with it
and CMake refuses to generate at all:

  CMake Error: The INTERFACE_QT_MAJOR_VERSION property of "Qt5::Core" does
  not agree with the value of QT_MAJOR_VERSION already determined
  CMake Generate step failed.  Build files cannot be regenerated correctly.

Note the problem is the Qt5/Qt6 *mix*, not Qt5 being unavailable: Qt5 is
still perfectly installable on Resolute (CI shows apt-get install qtbase5-dev
pulling qt5-qmake-bin 5.15.18+dfsg-1ubuntu1). Availability is therefore the
wrong thing to gate on -- see below.

The Qt6 switch is ros2/rviz#1635 "Use qt6 as the default dependency from
rosdep" (ahcorde, merged 2025-12-08, commit 4784c8cd), which flipped
rviz_common's package.xml from qtbase5-dev/libqt5-* to qt6-base-dev/libqt6-*.
It first shipped in rviz 15.1.14 (tagged 2025-12-17) -- note 15.1.0 through
15.1.13 are still Qt5, so the threshold is 15.1.14 and not 15.1.

Gate on rviz_common_VERSION rather than on whether Qt6 is installed. An
availability probe (find_package(Qt6 QUIET)) says nothing about which Qt rviz
was built against, and rviz_visual_tools_gui links rviz_common, rviz_rendering,
rviz_default_plugins and rviz_ogre_vendor::OgreMain, so its Qt must match
rviz's. On a jazzy or kilted machine that also has qt6-base-dev installed, the
availability probe does not silently mis-select -- it aborts the configure,
because rviz_common has already defined the versionless Qt::Core target:

  CMake Error at Qt6CoreVersionlessTargets.cmake:42:
    Some (but not all) targets in this export set were already defined.
    Targets Defined: Qt::Core
    Targets not yet defined: Qt::CorePrivate

QUIET does not suppress that -- it is a FATAL_ERROR inside Qt6's own config,
not a not-found condition, so the Qt5 fallback is never reached.

Validated in osrf/ros:<distro>-desktop containers, comparing the gate's choice
against objdump of librviz_common.so:

  distro   rviz_common  gate  rviz links
  humble   11.2.26      Qt5   libQt5Core
  jazzy    14.1.22      Qt5   libQt5Core
  kilted   15.0.13      Qt5   libQt5Core
  lyrical  15.2.4       Qt6   libQt6Core
  rolling  16.0.1       Qt6   libQt6Core

Also verified that with qt6-base-dev additionally installed on jazzy and
kilted, this gate still selects Qt5 and configures cleanly.

Mirrors the approach taken in moveit/moveit2#3707, including the QT_DIR hint
for transitive deps whose find_package(QT NAMES Qt6 Qt5 ...) can mis-resolve
to Qt5 under CMake's ascending path order.

No source-side Qt6 changes are needed here: this package has no .ui files and
none of the Qt5-only API patterns moveit2 had to fix -- only plain widget
includes, Q_OBJECT, QCursor and Qt::Key_N enums, all unchanged in Qt6.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

* package.xml: use versionless Qt rosdep keys

The CMake change alone is not enough. package.xml still hard-coded Qt5
rosdep keys:

  <build_depend>qtbase5-dev</build_depend>
  <exec_depend>libqt5-widgets</exec_depend>

Those resolve to Qt5 on every platform, so on Resolute rosdep installs Qt5
while CMake needs Qt6 to match rviz -- which is exactly how the
INTERFACE_QT_MAJOR_VERSION collision fixed in the previous commit arises.
CI confirms the sequence: apt-get install qtbase5-dev and libqt5widgets5t64
both succeed on ubuntu:resolute, and the build then fails at generate.

(To be clear, Qt5 has not been removed from Resolute's apt indexes; it
installs fine. It simply must not be mixed with the Qt6 rviz we link.)

Switch to the versionless keys, which rosdep maps per-platform. This is the
same move ros2/rviz#1635 made in rviz_common's package.xml:

  key             jammy           noble               * (resolute)
  qt-base-dev     qtbase5-dev     qtbase5-dev         qt6-base-dev
  libqtwidgets    libqt5widgets5  libqt5widgets5t64   libqt6widgets6

That mapping agrees with the CMake gate on all five distros, so rosdep
installs exactly the Qt that CMake then selects:

  humble  (jammy)    rviz 11.2  -> Qt5
  jazzy   (noble)    rviz 14.1  -> Qt5
  kilted  (noble)    rviz 15.0  -> Qt5
  lyrical (resolute) rviz 15.2  -> Qt6
  rolling (resolute) rviz 16.0  -> Qt6

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to moveit/moveit2 that referenced this pull request Aug 2, 2026
The Qt6 gates added in #3707 test `rviz2_VERSION VERSION_GREATER_EQUAL 15.1`,
but rviz did not switch to Qt6 at 15.1.0. ros2/rviz#1635 ("Use qt6 as the
default dependency from rosdep", ahcorde, merged 2025-12-08, commit 4784c8cd)
first shipped in the 15.1.14 tag on 2025-12-17. Bisecting rviz_common's
package.xml:

  15.1.11  qtbase5-dev
  15.1.12  qtbase5-dev
  15.1.13  qtbase5-dev
  15.1.14  qt6-base-dev   <- switch

So 15.1.0 through 15.1.13 are Qt5 but are currently classified as Qt6. Any
build against an rviz in that window picks Qt6 while rviz itself is Qt5.

No active distro sits in that window today (humble 11.2.x, jazzy 14.1.x,
kilted 15.0.x are Qt5; lyrical 15.2.x and rolling 16.0.x are Qt6), so this is
latent rather than currently breaking -- but kilted is at 15.0.13, one patch
series below the bad range.

Applied to all 8 CMakeLists.txt carrying the gate (moveit_ros/visualization
plus the 7 moveit_setup_assistant packages).

Verified in osrf/ros:<distro>-desktop containers that rviz2_VERSION and
rviz_common_VERSION agree and that the corrected gate still resolves
correctly: kilted 15.0.13 -> Qt5, lyrical 15.2.4 -> Qt6, rolling 16.0.1 -> Qt6.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
nbbrooks added a commit to moveit/moveit2 that referenced this pull request Aug 3, 2026
The Qt6 gates added in #3707 test `rviz2_VERSION VERSION_GREATER_EQUAL 15.1`,
but rviz did not switch to Qt6 at 15.1.0. ros2/rviz#1635 ("Use qt6 as the
default dependency from rosdep", ahcorde, merged 2025-12-08, commit 4784c8cd)
first shipped in the 15.1.14 tag on 2025-12-17. Bisecting rviz_common's
package.xml:

  15.1.11  qtbase5-dev
  15.1.12  qtbase5-dev
  15.1.13  qtbase5-dev
  15.1.14  qt6-base-dev   <- switch

So 15.1.0 through 15.1.13 are Qt5 but are currently classified as Qt6. Any
build against an rviz in that window picks Qt6 while rviz itself is Qt5.

No active distro sits in that window today (humble 11.2.x, jazzy 14.1.x,
kilted 15.0.x are Qt5; lyrical 15.2.x and rolling 16.0.x are Qt6), so this is
latent rather than currently breaking -- but kilted is at 15.0.13, one patch
series below the bad range.

Applied to all 8 CMakeLists.txt carrying the gate (moveit_ros/visualization
plus the 7 moveit_setup_assistant packages).

Verified in osrf/ros:<distro>-desktop containers that rviz2_VERSION and
rviz_common_VERSION agree and that the corrected gate still resolves
correctly: kilted 15.0.13 -> Qt5, lyrical 15.2.4 -> Qt6, rolling 16.0.1 -> Qt6.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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.

5 participants