Skip to content
This repository was archived by the owner on Dec 9, 2021. It is now read-only.

Generated header guards collide #30

Closed
mathias-luedtke opened this issue May 8, 2019 · 12 comments
Closed

Generated header guards collide #30

mathias-luedtke opened this issue May 8, 2019 · 12 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@mathias-luedtke
Copy link

control_msgs contains a GripperCommand action, which uses the GripperCommand msg.

For ROS2 dashing, this package (released version, 0.7.0, and master) generates C header files with duplicated guard names, e.g.

$ grep -r _GRIPPERCOMMAND__H_ .
./build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/msg/dds_opensplice/GripperCommand_.h:#ifndef _GRIPPERCOMMAND__H_
./build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/msg/dds_opensplice/GripperCommand_.h:#define _GRIPPERCOMMAND__H_
./build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/dds_opensplice/GripperCommand_.h:#ifndef _GRIPPERCOMMAND__H_
./build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/dds_opensplice/GripperCommand_.h:#define _GRIPPERCOMMAND__H_

For this reason the build fails with:

In file included from /root/target_ws/build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/dds_opensplice/ccpp_GripperCommand_.h:4:0,
                 from /root/target_ws/build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/gripper_command__rosidl_typesupport_opensplice_cpp.hpp:10,
                 from /root/target_ws/build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/dds_opensplice/gripper_command__type_support.cpp:17:
/root/target_ws/build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/dds_opensplice/GripperCommand_.h:41:37: error: ‘dds_’ in namespace ‘control_msgs::msg’ does not name a type
                ::control_msgs::msg::dds_::GripperCommand_ command_;
                                     ^~~~
/root/target_ws/build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/dds_opensplice/gripper_command__type_support.cpp: In function ‘void control_msgs::action::typesupport_opensplice_cpp::convert_ros_message_to_dds(const __ros_msg_type_GripperCommand_Goal&, control_msgs::action::typesupport_opensplice_cpp::__dds_msg_type_GripperCommand_Goal&)’:
/root/target_ws/build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/dds_opensplice/gripper_command__type_support.cpp:108:38: error: ‘using __dds_msg_type_GripperCommand_Goal = struct control_msgs::action::dds_::GripperCommand_Goal_ {aka struct control_msgs::action::dds_::GripperCommand_Goal_}’ has no member named ‘command_’
     ros_message.command, dds_message.command_);
                                      ^~~~~~~~
/root/target_ws/build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/dds_opensplice/gripper_command__type_support.cpp: In function ‘void control_msgs::action::typesupport_opensplice_cpp::convert_dds_message_to_ros(const __dds_msg_type_GripperCommand_Goal&, control_msgs::action::typesupport_opensplice_cpp::__ros_msg_type_GripperCommand_Goal&)’:
/root/target_ws/build/control_msgs/rosidl_typesupport_opensplice_cpp/control_msgs/action/dds_opensplice/gripper_command__type_support.cpp:164:17: error: ‘const __dds_msg_type_GripperCommand_Goal {aka const struct control_msgs::action::dds_::GripperCommand_Goal_}’ has no member named ‘command_’
     dds_message.command_, ros_message.command);

Furthermore, JointTrajectory.action (control_msgs) collides with JointTrajectory.msg (trajectory_msgs), both use _JOINTTRAJECTORY__H_.

For ROS2 crystal the generated header guards are less likely to collide, because goal, feedback and result are generated separately. (before #11?)

To avoid this problem the guards should contain the package name and the type to make them unique.
The files in dds_opensplice get generated by idlpp though.

@dirk-thomas
Copy link
Member

The files in dds_opensplice get generated by idlpp though.

Can you please report the bug upstream.

@mathias-luedtke
Copy link
Author

Can you please report the bug upstream.

This is not necessarily a bug upstream.
You could even take care of it in the post-processing or by making the file names unique.
This is completely up to you.
I just noticed that my dashing test job started to fail recently.

@dirk-thomas
Copy link
Member

dirk-thomas commented May 9, 2019

It is certainly a bug upstream. Both types have the same name but different namespaces which distinguishes them. The header guard must include the namespaces.

We could workaround the problem in post processing but would rather see this fixed upstream.

@anasarrak
Copy link

Any fix for this? I'm struggling with the same problem

@dirk-thomas dirk-thomas added bug Something isn't working duplicate This issue or pull request already exists labels Jun 4, 2019
@mathias-luedtke
Copy link
Author

This issues seems to be resolved 👍

@mathias-luedtke
Copy link
Author

mathias-luedtke commented Jul 11, 2019

This issues seems to be resolved +1

Not resolved, but rosidl_typesupport_opensplice is not part of the dashing Docker image anymore..

@dirk-thomas
Copy link
Member

Reopening since the problem hasn't been resolved yet.

@dirk-thomas dirk-thomas reopened this Jul 15, 2019
@MarcelJordense
Copy link
Contributor

@ipa-mdl Is the problem still present when using the latest OpenSplice release? When I try to build the control_msgs with the latest OpenSplice release I do not see any problems.

@mathias-luedtke
Copy link
Author

Is the problem still present when using the latest OpenSplice release?

It is still present if I install rosidl_typesupport_opensplice from the official ROS2 repository, which pulls libopensplice69 (Version: 6.9.190705+osrf1-1~bionic).
(I am not actually using OpenSplice..)

@MarcelJordense
Copy link
Contributor

@ipa-mdl Which version of rosidl_typesupport_opensplice are you using? It should have be resolved in dashing.

@mathias-luedtke
Copy link
Author

mathias-luedtke commented Aug 19, 2019

Which version of rosidl_typesupport_opensplice are you using? It should have be resolved in dashing.

@MarcelJordense: the latest release: ros-dashing-rosidl-typesupport-opensplice-cpp, version ros-dashing-rosidl-typesupport-opensplice-cpp

I will try to come up with a Travis build

@mathias-luedtke
Copy link
Author

@MarcelJordense:
After reinstalling ROS dashing (purge + install) it works properly.
A full upgrade and a freshly created workspace did not work.
I guess something was broken in my system.

Travis confirms that it works.

I will close this issue :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants