Build depend on rclcpp
Closed this issue · 2 comments
Build conditionnal depend on rclcpp and rclcpp_components and ament_lint_auto
- Version: ROS2 jazzy
- Platform: Ubuntu 24.04 (WSL)
I do build a minimal version of ROS with only the required packages so I have a workspace with all ros required packages and others (like foxglove_bridge).
I then do build the whole ROS and additional packages in one colcon build step. So the ros environment is not sources before the build.
Steps To Reproduce
Build ROS together with ros-foxglove-bridge using colcon.
CMake returned an error as it can't find required package rclcpp, rclcpp_components and ament_lint_auto.
The reason is that before ros build and source, the $ROS_VERSION env variable is not set so all conditional depends are ignored.
Manually exporting that variable works well but it should not be required...
I'm not a colcon expert but I guess the target ros distribution should be available in some variables during build so maybe use an other variable to define the conditionals.
Expected Behavior
Build successfull without manually exporting the $ROS_VERSION
It is common for packages that can be built for both ROS1 and ROS2 to rely on the ROS_VERSION
env variable to determine which version is to be built. This env variable is set by ros_environment
pkg which this package build-depends on. I would propose that you set this variable yourself if ros_environment
doesn't work for you.