Difference in build_depend in package format 3 vs. package format 2
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?
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 bothbuild_depend
andexec_depend
, or simplydepend
if it also export headers with symbols for these packages.An example a simple C++ publisher
package.xml
can be found hereThe tutorial can be edited via PR on github (there's an "edit on github" button at the top of the page)
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 ofexec_depend
.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.