ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Difference in build_depend in package format 3 vs. package format 2

asked 2020-03-25 10:03:13 -0500

updated 2020-03-25 10:56:52 -0500

In the ROS 2 tutorial for writing a simple pub/sub package, it says to add the following in the package.xml file:


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?

edit retag flag offensive close merge delete


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)

marguedas gravatar image marguedas  ( 2020-03-25 10:31:35 -0500 )edit

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.

gvdhoorn gravatar image gvdhoorn  ( 2020-03-25 10:34:34 -0500 )edit

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.

Jeffrey Kane Johnson gravatar image Jeffrey Kane Johnson  ( 2020-03-25 10:57:04 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-03-25 11:14:23 -0500

As suggested the comments, I submitted a PR to update the tutorial documentation:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-03-25 10:03:13 -0500

Seen: 846 times

Last updated: Mar 25 '20