In the ROS 2 tutorial for writing a simple pub/sub package, it says to add the following in the package.xml file:
<exec_depend>rclcpp</exec_depend>
<exec_depend>std_msgs</exec_depend>
But shouldn't these also have the build_depend
tag? From my reading of package format 3, it seems like they should also be build dependencies:
build_depend: Declares a rosdep key or ROS package name that this package requires at build-time.
Aren't rclcpp and std_msgs required at build time?
Originally posted by Jeffrey Kane Johnson on ROS Answers with karma: 452 on 2020-03-25
Post score: 0
Original comments
Comment by marguedas on 2020-03-25:
Semantic of build_depend
did not change between package format 2 and format 3.
You are right, the tutorial is incomplete, these dependencies are needed both at build-time and execution-time so the package.xml
should list both build_depend
and exec_depend
, or simply depend
if it also export headers with symbols for these packages.
An example a simple C++ publisher package.xml
can be found here
The tutorial can be edited via PR on github (there's an "edit on github" button at the top of the page)
Comment by gvdhoorn on 2020-03-25:
I don't believe anything has changed wrt build_depend
(at least not in the context you are asking about).
This particular tutorial was added in ros2/ros2_documentation#366 and a comment about this was added (here).
Afaict, it should probably be depend
instead of exec_depend
.
Comment by Jeffrey Kane Johnson on 2020-03-25:
Thanks, @marguedas and @gvdhoorn, that clarifies it for me. I also realize now that my interpretation of the documentation for package format 2 was not correct. I edited the question to reflect that.