Skip to content

Use Qt6 on Rolling and newer distros - #3707

Merged
nbbrooks merged 6 commits into
moveit:mainfrom
nbbrooks:pr-qt6-support
Mar 23, 2026
Merged

nbbrooks merged 6 commits into
moveit:mainfrom
nbbrooks:pr-qt6-support

Conversation

@nbbrooks

@nbbrooks nbbrooks commented Mar 16, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Rviz switchd to Qt6 in version 15.1 ros2/rviz#1635

As we support the latest features in main being source built to non-EOL distros, the following cases must be supported

  • Humble (Ubuntu 22.04): Use Qt5
  • Jazzy (Ubuntu 24.04): Use Qt5
  • Kilted (Ubuntu 24.04): Use Qt5
  • Rolling (currently Ubuntu 42.04): Use Qt6

There are some specific checks in here to handle cases where Qt5 and Qt6 are installed.

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

@codecov

codecov Bot commented Mar 16, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.22%. Comparing base (f1135a4) to head (687f30f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...plugin/src/motion_planning_frame_joints_widget.cpp 0.00% 2 Missing ⚠️
...eit_setup_framework/src/xml_syntax_highlighter.cpp 0.00% 2 Missing ⚠️
..._setup_srdf_plugins/src/collision_linear_model.cpp 0.00% 2 Missing ⚠️
..._setup_srdf_plugins/src/collision_matrix_model.cpp 0.00% 2 Missing ⚠️
...tup_srdf_plugins/src/default_collisions_widget.cpp 0.00% 2 Missing ⚠️
...planning_rviz_plugin/src/motion_planning_frame.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            main    #3707       +/-   ##
==========================================
+ Coverage   0.00%   46.22%   +46.22%     
==========================================
  Files        539      726      +187     
  Lines      47592    59497    +11905     
  Branches    6085     7624     +1539     
==========================================
+ Hits           0    27499    +27499     
+ Misses     47592    31832    -15760     
- Partials       0      166      +166     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…d 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
…case for Jazzy/Kilted with both Qt6 and Qt5, where Qt5 should be picked.
@nbbrooks nbbrooks changed the title Another take on Qt6 support Use Qt6 on Rolling and newer distroes Mar 22, 2026
…but incorrectly resolve to Qt5 due to default cmake order resolution
@nbbrooks nbbrooks changed the title Use Qt6 on Rolling and newer distroes Use Qt6 on Rolling and newer distros Mar 23, 2026
@nbbrooks

nbbrooks commented Mar 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

The [CI / rolling-ci + ikfast + clang-tidy](https://github.com/moveit/moveit2/actions/runs/23422946195/job/68131764804?pr=3707) failure appears unrelated to the Qt5/Qt6 issues that are present on main.

@nbbrooks
nbbrooks enabled auto-merge (squash) March 23, 2026 06:24
@nbbrooks
nbbrooks requested a review from stephanie-eng March 23, 2026 06:25
@nbbrooks
nbbrooks disabled auto-merge March 23, 2026 06:26
@nbbrooks
nbbrooks merged commit 6914697 into moveit:main Mar 23, 2026
8 of 11 checks passed
@github-project-automation github-project-automation Bot moved this to ✅ Done in MoveIt Mar 23, 2026
nbbrooks added a commit to nbbrooks/moveit2 that referenced this pull request Jun 8, 2026
ament_target_dependencies was deprecated and removed upstream
(ament/ament_cmake#614). Replace it with explicit
target_link_libraries(... NAMESPACE::TARGET) calls across the
codebase, matching the ROS 2 Kilted-and-newer guidance.

Two subtleties needed extra care:

- ament_target_dependencies(... Boost ...) implicitly linked every
  Boost component found by ConfigExtras.cmake (chrono, date_time,
  filesystem, iostreams, program_options, regex, serialization,
  system, thread). A bare target_link_libraries(... Boost::headers)
  drops those compiled components and breaks any translation unit
  that uses non-header-only Boost. Targets that need them now name
  their components explicitly:
  - moveit_test_utils: + Boost::regex
    (robot_model_test_utils.cpp uses boost::split_regex / boost::regex)
  - moveit_ompl_interface: + Boost::serialization
    (detail/constraints_library.hpp uses boost::serialization::map)
  - moveit_ros_benchmarks: + Boost::filesystem + Boost::regex
    (BenchmarkExecutor.cpp uses both)

- The random_numbers::random_numbers imported target was only added
  upstream in moveit/random_numbers#47 (merged 2025-05-27, "[kilted]"),
  so it doesn't exist on jazzy or humble and the CMake configure step
  fails there. moveit_kdl_kinematics_plugin uses the variable form
  ${random_numbers_LIBRARIES} with a matching
  target_include_directories instead, so the build works across all
  supported distros.

Also add find_package(rviz2 REQUIRED) to moveit_ros_visualization so
that rviz2_VERSION is available for the Qt5/Qt6 selection introduced
in moveit#3707, and resolve merge conflicts with that PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
nbbrooks added a commit to nbbrooks/moveit2 that referenced this pull request Jun 14, 2026
ament_target_dependencies was deprecated and removed upstream
(ament/ament_cmake#614). Replace it with explicit
target_link_libraries(... NAMESPACE::TARGET) calls across the
codebase, matching the ROS 2 Kilted-and-newer guidance.

Two subtleties needed extra care:

- ament_target_dependencies(... Boost ...) implicitly linked every
  Boost component found by ConfigExtras.cmake (chrono, date_time,
  filesystem, iostreams, program_options, regex, serialization,
  system, thread). A bare target_link_libraries(... Boost::headers)
  drops those compiled components and breaks any translation unit
  that uses non-header-only Boost. Targets that need them now name
  their components explicitly:
  - moveit_test_utils: + Boost::regex
    (robot_model_test_utils.cpp uses boost::split_regex / boost::regex)
  - moveit_ompl_interface: + Boost::serialization
    (detail/constraints_library.hpp uses boost::serialization::map)
  - moveit_ros_benchmarks: + Boost::filesystem + Boost::regex
    (BenchmarkExecutor.cpp uses both)

- The random_numbers::random_numbers imported target was only added
  upstream in moveit/random_numbers#47 (merged 2025-05-27, "[kilted]"),
  so it doesn't exist on jazzy or humble and the CMake configure step
  fails there. moveit_kdl_kinematics_plugin uses the variable form
  ${random_numbers_LIBRARIES} with a matching
  target_include_directories instead, so the build works across all
  supported distros.

Also add find_package(rviz2 REQUIRED) to moveit_ros_visualization so
that rviz2_VERSION is available for the Qt5/Qt6 selection introduced
in moveit#3707, and resolve merge conflicts with that PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
nbbrooks added a commit to nbbrooks/moveit2 that referenced this pull request Jun 15, 2026
ament_target_dependencies was deprecated and removed upstream
(ament/ament_cmake#614). Replace it with explicit
target_link_libraries(... NAMESPACE::TARGET) calls across the
codebase, matching the ROS 2 Kilted-and-newer guidance.

Two subtleties needed extra care:

- ament_target_dependencies(... Boost ...) implicitly linked every
  Boost component found by ConfigExtras.cmake (chrono, date_time,
  filesystem, iostreams, program_options, regex, serialization,
  system, thread). A bare target_link_libraries(... Boost::headers)
  drops those compiled components and breaks any translation unit
  that uses non-header-only Boost. Targets that need them now name
  their components explicitly:
  - moveit_test_utils: + Boost::regex
    (robot_model_test_utils.cpp uses boost::split_regex / boost::regex)
  - moveit_ompl_interface: + Boost::serialization
    (detail/constraints_library.hpp uses boost::serialization::map)
  - moveit_ros_benchmarks: + Boost::filesystem + Boost::regex
    (BenchmarkExecutor.cpp uses both)

- The random_numbers::random_numbers imported target was only added
  upstream in moveit/random_numbers#47 (merged 2025-05-27, "[kilted]"),
  so it doesn't exist on jazzy or humble and the CMake configure step
  fails there. moveit_kdl_kinematics_plugin uses the variable form
  ${random_numbers_LIBRARIES} with a matching
  target_include_directories instead, so the build works across all
  supported distros.

Also add find_package(rviz2 REQUIRED) to moveit_ros_visualization so
that rviz2_VERSION is available for the Qt5/Qt6 selection introduced
in moveit#3707, and resolve merge conflicts with that PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
nbbrooks added a commit that referenced this pull request Jun 16, 2026
* Remove use of ament_target_dependencies

ament_target_dependencies was deprecated and removed upstream
(ament/ament_cmake#614). Replace it with explicit
target_link_libraries(... NAMESPACE::TARGET) calls across the
codebase, matching the ROS 2 Kilted-and-newer guidance.

Two subtleties needed extra care:

- ament_target_dependencies(... Boost ...) implicitly linked every
  Boost component found by ConfigExtras.cmake (chrono, date_time,
  filesystem, iostreams, program_options, regex, serialization,
  system, thread). A bare target_link_libraries(... Boost::headers)
  drops those compiled components and breaks any translation unit
  that uses non-header-only Boost. Targets that need them now name
  their components explicitly:
  - moveit_test_utils: + Boost::regex
    (robot_model_test_utils.cpp uses boost::split_regex / boost::regex)
  - moveit_ompl_interface: + Boost::serialization
    (detail/constraints_library.hpp uses boost::serialization::map)
  - moveit_ros_benchmarks: + Boost::filesystem + Boost::regex
    (BenchmarkExecutor.cpp uses both)

- The random_numbers::random_numbers imported target was only added
  upstream in moveit/random_numbers#47 (merged 2025-05-27, "[kilted]"),
  so it doesn't exist on jazzy or humble and the CMake configure step
  fails there. moveit_kdl_kinematics_plugin uses the variable form
  ${random_numbers_LIBRARIES} with a matching
  target_include_directories instead, so the build works across all
  supported distros.

Also add find_package(rviz2 REQUIRED) to moveit_ros_visualization so
that rviz2_VERSION is available for the Qt5/Qt6 selection introduced
in #3707, and resolve merge conflicts with that PR.

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

* Address review feedback: fix Qt linking and drop redundant link deps

Link the imported Qt targets (Qt${QT_VERSION_MAJOR}::Core/::Widgets)
instead of the undefined ${QT_CORE}/${QT_WIDGETS} variables, remove a
duplicate rviz_ogre_vendor::OgreMain, and drop redundant transitive
dependencies (rmw_implementation, urdfdom_headers) already provided by
rclcpp and urdfdom::urdf_parser.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Remove redundant Qt discovery in moveit_setup_framework

The rviz2-version-based Qt selection already finds Qt before any rviz or
moveit dependency, so the second find_package(Qt6) block was redundant and
could pull in Qt6 even on the Qt5 path.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Address review feedback: export Qt dep, drop unused Boost in benchmarks

Add Qt to moveit_setup_assistant's exported dependencies so downstream
consumers of its targets resolve the Qt imported targets. Drop the unused
Boost::regex/Boost::filesystem links (and their includes) from benchmarks,
which uses std::regex/std::filesystem.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

* Address review feedback: link Boost::date_time, drop redundant class_loader

Link Boost::date_time in moveit_ros_benchmarks and moveit_ompl_interface,
which use boost::posix_time but only linked Boost::headers after the
ament_target_dependencies(... Boost) removal (the old call pulled in all
Boost components). The Boost::date_time imported target is already found
via ConfigExtras.cmake / the top-level find_package.

Drop the redundant class_loader::class_loader link from moveit_plan_execution
and moveit_kinematics_plugin_loader; pluginlib::pluginlib already re-exports
class_loader, and these targets only use the pluginlib wrapper
(<pluginlib/class_loader.hpp>), not class_loader directly.

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

* Address review feedback: export Qt Core/Widgets component packages

ament_export_dependencies(Qt${QT_VERSION_MAJOR}) emits find_dependency(Qt6)
in the package config, but find_package(Qt6) without COMPONENTS does not
define the Qt6::Core / Qt6::Widgets imported targets that the exported
targets link against. Downstream find_package(moveit_setup_framework) /
find_package(moveit_setup_assistant) would then fail to resolve those
targets.

Export the standalone Qt${QT_VERSION_MAJOR}Core / Qt${QT_VERSION_MAJOR}Widgets
packages instead, whose configs define Qt6::Core / Qt6::Widgets. The
component find_package already sets Qt6Core_FOUND / Qt6Widgets_FOUND, so
ament_export_dependencies accepts them.

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

* Address review feedback: link/export tf2_ros where used in public headers

moveit_robot_interaction and moveit_ros_occupancy_map_monitor use tf2_ros
(tf2_ros::Buffer) in their public headers but only received it transitively.
Link tf2_ros::tf2_ros (plus tf2/tf2_eigen, already used in robot_interaction's
sources) explicitly and export it via THIS_PACKAGE_INCLUDE_DEPENDS so
downstream consumers of those headers resolve the dependency. Also link
tf2_ros into the occupancy_map_server executable, which uses
tf2_ros::TransformListener/Buffer directly.

Clarify the moveit_ros_move_group umbrella INTERFACE target comment: it
exposes the capabilities API (moveit_move_group_capabilities_base);
moveit_move_group_default_capabilities is a runtime pluginlib plugin and is
intentionally excluded.

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

* Link tf2_geometry_msgs via its imported target, not ${tf2_geometry_msgs_TARGETS}

tf2_geometry_msgs is a plain C++ library package (not a rosidl interface
package), exporting a single imported target tf2_geometry_msgs::tf2_geometry_msgs
via ament_export_targets(). Linking that namespaced target is the idiomatic,
documented form for a library, and it fails loudly if the target is ever
missing -- whereas an undefined ${..._TARGETS} variable expands to empty and
silently drops the dependency. The _TARGETS variable form is reserved for
rosidl interface (msg/srv/action) packages, which generate multiple
typesupport targets with no single aggregate target on all distros.

No behavioral change: both forms resolve to the same target today.

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

---------

Co-authored-by: Claude Opus 4.7 (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, 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 nbbrooks mentioned this pull request Aug 2, 2026
1 of 5 tasks
nbbrooks added a commit 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
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
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
* 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 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 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.

1 participant