ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

catkin optional build dependency

asked 2013-09-26 07:46:32 -0500

mtourne gravatar image

updated 2021-10-26 09:02:26 -0500

lucasw gravatar image

I'm trying to compile hector_quadrotor using catkin_make, but I'm running into this issue :

The main problem is that hector_pose_estimation uses the hector_uav_msgs package only if it is available at build time (by find_package).

But hector_pose_estimation is usable without hector_uav_msgs, so it can't be a build dependency.

And because hector_uav_msgs is not a build dep of hector_pose_estimation, catkin_make will try to build hector_pose_estimation before hector_uav_msgs.

Is there a trick to declare optional build dependencies, or to force the dependency to build hector_uav_msgs prior to hector_pose_estimation ?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-09-26 12:59:27 -0500

William gravatar image

There is no way to affect build order in a single workspace other than a build_depend tag. There is no notion of optional dependencies.

I imagine that hector_pose_estimation will publish data in messages defined in hector_uav_msgs, but the code to do so will only be built iff hector_uav_msgs is found? A different way to do this (without optional dependencies) is to have a third package which builds a plugin for hector_pose_estimation and directly depends on both hector_pose_estimation and hector_uav_msgs. At runtime a node in hector_pose_estimation could discover, load, and execute the plugin from the third package OR you could produce a node in the third package which is a drop-in replacement of the node(s) in hector_pose_estimation but which also publishes the messages. This way hector_pose_estimation is simplified and does not require an optional dependency on hector_uav_msgs, and to add this new functionality you just add hector_uav_msgs and the new third package to the workspace.

A workaround is to build hector_uav_msgs in a separate workspace before building hector_pose_estimation. This ensures that hector_uav_msgs is built first.

edit flag offensive delete link more


In the meantime, I did exactly this. All optional dependencies on hector_uav_msgs have been removed from hector_pose_estimation and I added a separate package hector_quadrotor_pose_estimation. Anyway, having something like optional build dependencies in package.xml would be a nice feature for catkin.

Johannes Meyer gravatar image Johannes Meyer  ( 2013-10-12 04:07:17 -0500 )edit

answered 2013-09-26 12:38:54 -0500

joq gravatar image

If the messages are present, do this for each target using them:

add_dependencies(your_program ${catkin_EXPORTED_TARGETS})

See the catkin documentation for details.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-09-26 07:46:32 -0500

Seen: 1,001 times

Last updated: Oct 24 '21