Fail at ROS2 IDL generation
I tried to add support for ROS2 IDL generation with Rust.
It happens to work only when find_package
are declared in packages containing message definitions with
find_package(rosidl_default_generators REQUIRED)
first.
It means that in std_msgs
for example, the following will make the whole generation work.
find_package(rosidl_default_generators REQUIRED)
find_package(builtin_interfaces REQUIRED)
While this will fail :
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)
With the following error.
CMake Error at /opt/ros/crystal/share/rosidl_cmake/cmake/rosidl_target_interfaces.cmake:44 (message):
rosidl_target_interfaces() the second argument 'std_msgs' concatenated with
the third argument 'rosidl_typesupport_c' using double underscores must be
a valid target name
Call Stack (most recent call first):
/home/sisyphe/Projects/tests/ros2_rust_ws/install/share/rosidl_generator_rs/cmake/rosidl_generator_rs_generate_interfaces.cmake:200 (rosidl_target_interfaces)
/opt/ros/crystal/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:38 (include)
/opt/ros/crystal/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:280 (ament_execute_extensions)
CMakeLists.txt:49 (rosidl_generate_interfaces)
The file rosidl_generator_rs_generate_interfaces.cmake generating this error can be found in this repository.
I seems that the required target does not exist at the right time but I don't know what dependency to add to fix this.
I don't understand the whole ROS2 IDL generation process yet and any help on how to be more knowledgeable on this matter might be useful.
Trying to build a workspace containing the referenced repository works fine for me (at least until
rclrs_examples
which fails to invokecargo
which I don't have installed). Please describe the exact steps when you see the error.You're right, the repository compiles because I have manually edited all message packages to reorder
find_package
.I have created a dedicated branch std_msgs_fail which reproduce the issue and should not compile.
I just tried to build a workspace using the
std_msgs_fail
branch and it passed (at least as far as the previous build) without a problem.I've just figured that I cannot reproduce my issue without the
--merge-install
argument oncolcon build
, which I was always using until now. Could you try again ?