rosidl
rosidl copied to clipboard
detect duplicate rosidl_generate_interfaces calls and give a useful error
Feature request
Feature description
If you accidentally get two copies of a message into your invocation of rosidl_generate_interfaces it will fail eventually due to the redefnition of symbols. But it would be great if the cmake would warn or error if the names are not unique and give a much simpler answer than what currently errors.
Clearly it would be better for the developer to not do this but sometimes a long list isn't maintained as well as would be expected and they will get in on accident.
An example of the error when building with two Int8 datatypes in the list. It gets all the way to the python generator.
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c:3787:15: error: redefinition of ‘example_interfaces__msg__u_int8__create_ros_message’
static void * example_interfaces__msg__u_int8__create_ros_message(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c:2811:15: note: previous definition of ‘example_interfaces__msg__u_int8__create_ros_message’ was here
static void * example_interfaces__msg__u_int8__create_ros_message(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c:3792:13: error: redefinition of ‘example_interfaces__msg__u_int8__destroy_ros_message’
static void example_interfaces__msg__u_int8__destroy_ros_message(void * raw_ros_message)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c:2816:13: note: previous definition of ‘example_interfaces__msg__u_int8__destroy_ros_message’ was here
static void example_interfaces__msg__u_int8__destroy_ros_message(void * raw_ros_message)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c:3809:1: error: redefinition of ‘_register_msg_type__msg__u_int8’
_register_msg_type__msg__u_int8(PyObject * pymodule)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c:2833:1: note: previous definition of ‘_register_msg_type__msg__u_int8’ was here
_register_msg_type__msg__u_int8(PyObject * pymodule)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_c.c:3787:15: error: redefinition of ‘example_interfaces__msg__u_int8__create_ros_message’
static void * example_interfaces__msg__u_int8__create_ros_message(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_c.c:2811:15: note: previous definition of ‘example_interfaces__msg__u_int8__create_ros_message’ was here
static void * example_interfaces__msg__u_int8__create_ros_message(void)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_c.c:3792:13: error: redefinition of ‘example_interfaces__msg__u_int8__destroy_ros_message’
static void example_interfaces__msg__u_int8__destroy_ros_message(void * raw_ros_message)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_c.c:2816:13: note: previous definition of ‘example_interfaces__msg__u_int8__destroy_ros_message’ was here
static void example_interfaces__msg__u_int8__destroy_ros_message(void * raw_ros_message)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_c.c:3809:1: error: redefinition of ‘_register_msg_type__msg__u_int8’
_register_msg_type__msg__u_int8(PyObject * pymodule)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ei_ws/build/example_interfaces/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_c.c:2833:1: note: previous definition of ‘_register_msg_type__msg__u_int8’ was here
_register_msg_type__msg__u_int8(PyObject * pymodule)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/example_interfaces__rosidl_typesupport_fastrtps_c__pyext.dir/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_fastrtps_c.c.o] Error 1
make[1]: *** [CMakeFiles/example_interfaces__rosidl_typesupport_fastrtps_c__pyext.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/example_interfaces__rosidl_typesupport_c__pyext.dir/rosidl_generator_py/example_interfaces/_example_interfaces_s.ep.rosidl_typesupport_c.c.o] Error 1
make[1]: *** [CMakeFiles/example_interfaces__rosidl_typesupport_c__pyext.dir/all] Error 2