Repository navigation
fix: build on ROS 2 Lyrical - #551
Merged
Merged
Conversation
Replace ament_target_dependencies with explicit imported-target linking for the grid_map_ros library. The Lyrical ament toolchain no longer accepts the legacy SYSTEM dependency expansion used here. Linking the exported ROS interface targets directly preserves transitive include paths and libraries, while retaining grid_map_cv's legacy variables until that package exports an imported target. This change allows grid_map_ros 2.4.0 to build on ROS 2 Lyrical and removes the need for downstream CMake patches. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Nov 13, 2026
ROS 2 Lyrical removed ament_target_dependencies (ament/ament_cmake#614). CMake then stops with: Unknown CMake command "ament_target_dependencies". Dependencies that export CMake targets link the targets. The grid_map packages that export only variables use <pkg>_LIBRARIES and <pkg>_INCLUDE_DIRS, which is what ament_target_dependencies did. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
RViz on Lyrical and Rolling uses Qt 6. With Qt 5, the moc output does not match the Qt headers. Find Qt 6 first and fall back to Qt 5, as rviz_common does, and use the versionless qt_wrap_cpp. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
On Ubuntu 26.04, opencv_viz (through grid_map_ros) links VTK targets, and VTK::jsoncpp links JsonCpp::JsonCpp. VTK defines that target only when a caller asks for its jsoncpp component, and PCL does not. The CMake generate step then fails. find_package(jsoncpp) defines the target. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
Lyrical deprecates tf2_ros/transform_listener.h, rclcpp::spin_some and ament_index_cpp::get_package_share_directory. The packages build with -Werror, so each warning stops the build. Use tf2_ros/transform_listener.hpp, a SingleThreadedExecutor and get_package_share_path. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
OctoMap 1.10.1 and older include <ciso646>, which emits a #warning in C++20. Ubuntu 26.04 ships OctoMap 1.10.0. Keep the warning, but do not make it an error for the one demo that includes OctoMap. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
rviz_common, rviz_rendering and rviz_default_plugins declare Qt with qt-base-dev, libqtcore, libqtgui and libqtwidgets. Use the same keys, so that the plugin follows the Qt version of RViz. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
grid_map_package() adds -Werror only for GCC and Clang, so the exception follows the same condition. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
xmfcx
force-pushed
the
fix/lyrical-build
branch
from
November 13, 2026 16:13
c51ac50 to
c27e840
Compare
xmfcx
marked this pull request as ready for review
November 13, 2026 16:17
This was referenced Nov 13, 2026
This was referenced Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This PR makes all 15
grid_mappackages build on ROS 2 Lyrical (Ubuntu 26.04). Each commit fixes one problem:grid_map_ros. This is the commit of PR 545, unchanged.target_link_librariesinstead ofament_target_dependenciesin the other 8 packages that call it.grid_map_rviz_pluginwith Qt 6, and fall back to Qt 5, asrviz_commondoes.find_package(jsoncpp QUIET)beforegrid_map_pclfinds PCL.tf2_ros/transform_listener.h,rclcpp::spin_someandament_index_cpp::get_package_share_directory.<ciso646>warning from OctoMap an error inoctomap_to_gridmap_demo. The warning stays visible.grid_map_rviz_plugin/package.xmlwith the version-neutral rosdep keys that the RViz packages use.grid_map_package()does for-Werror.PR 545:
With tests on, which is the default, the tests of
grid_map_costmap_2dalso need the test fixes. The two PRs must merge together:Why
Without these changes, the build on Lyrical stops at these errors:
ament_target_dependencies, so CMake stops withUnknown CMake command "ament_target_dependencies".opencv_viz(throughgrid_map_ros) links VTK targets, andVTK::jsoncpplinksJsonCpp::JsonCpp. VTK defines that target only when a caller asks for itsjsoncppcomponent, and PCL does not. The CMake generate step fails.-Werror, so each deprecated API stops the build.OcTreeKey.hincludes<ciso646>, which emits a#warningin C++20. OctoMap fixed this after 1.10.1.The removal of
ament_target_dependencies:Known limitation: other packages that link
${grid_map_ros_LIBRARIES}and find PCL can hit the same VTK error as item 3, becausegrid_map_cvexports all OpenCV modules. This PR does not change that.Jazzy and Kilted build from their own branches, so this PR does not affect them.
The upstream checks on this PR are red, because the current CI still tests Rolling on Ubuntu 24.04. The CI PR fixes that:
How it was tested
colcon buildbuilt 15 packages, andcolcon testgave841 tests, 0 errors, 0 failures, 195 skipped. All skipped tests arecppcheck.-DBUILD_TESTING=OFF: 15 packages built.tf2_rosheader change one at a time. Each revert breaks the build ofgrid_map_rviz_plugin.${grid_map_ros_LIBRARIES},${grid_map_octomap_LIBRARIES},${grid_map_sdf_LIBRARIES}andgrid_map_rviz_plugin::grid_map_rviz_pluginbuilt and ran.ros2 run grid_map_demos tutorial_demopublished/grid_map.Colcon Build Test: https://github.com/autowarefoundation/grid_map/actions/runs/43460615289Industrial CI: https://github.com/autowarefoundation/grid_map/actions/runs/43460615834