4

I was told that build dependency and runtime dependency are different. But I don't know why. If some dependency is necessary while building, can't we also say that it is necessary for running? If some dependency is necessary while running, can't we also say that it is necessary for building?

I'm learning the ROS and reading this link: http://wiki.ros.org/catkin/package.xml

I've found that there are <build_depend> and <exec_depend>, which surprised me because I was always thinking that build-depend and exec-depend were always the same...

nbro
  • 12,226
  • 19
  • 85
  • 163
Yves
  • 8,474
  • 7
  • 59
  • 114

1 Answers1

3

For many (I would say most) packages, if it is a dependency then it is both a build dependency and a runtime dependency. However, this is not always the case. A notable example is when you are creating new messages in your package, you include message_generation as a build dependency, and message_runtime as an execution dependency in package.xml:

<build_depend>message_generation</build_depend> 
<exec_depend>message_runtime</exec_depend>

This is because when you're building you want message_generation for creating the header files for your message definition, but once they exist, you don't need the dependency to generate new messages at runtime - it only happens during the build process.

Likewise, message_runtime handles runtime bindings of your message definitions, which isn't relevant for the build process itself.

These different dependency tags give you finer control over managing the dependencies. There is a catch-all tag <depend></depend> that does not distinguish between these differences and can make your package.xml shorter if all your dependencies are both build and runtime dependencies.

This page gives an overview of the package.xml tags and relevant CMakeLists.txt info.

adamconkey
  • 2,420
  • 3
  • 20
  • 50