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

Packages without source cannot generate msgs?

asked 2014-05-30 18:14:52 -0500

K Chen gravatar image

I put several custom defined msgs in a package (named custom_msg_pkg), and this package does not contain any cpp or python sources. Then I have other packages depending on this package, using the provided custom msgs. But at compilation time (through catkin_make), the custom_msg_pkg is not being built first, so the compiler gives errors complaining not able to find the custom defined msgs in the custom_msg_pkg.

I am quite sure that I don't get it wrong in package.xml or CMakeLists.txt, since if I manually build them one by one, it works. So I think the problem lies in the order of building packages. In the custom_msg_pkg's CMakeLists.txt, I cannot add add_dependencies(executable custom_msg_pkg_generate_messages_cpp), so these messages are not built in the first place when I simple strike catkin_make.

So I am writing to ask:

  1. If there is some way to make the custom_msg_pkg built before the dependent packages?
  2. Is it a bad idea to have a package without source but only contains msg/srv files?

Thanks for any suggestions!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-05-30 18:44:15 -0500

ahendrix gravatar image
  1. It looks like you have most of your packages set up correctly, however you should be putting the add_dependencies line in the CMakeLists.txt for your other packages, NOT in your custom_msg_pkg. This allows you to explicitly declare that a particular binary in a dependant package depends on the generation of your custom messages.

  2. Yes; a package that contains only messages is fine, and it is the recommended practice for large projects.

edit flag offensive delete link more


Thanks for pointing out! It's indeed the problem.

K Chen gravatar image K Chen  ( 2014-06-02 04:59:57 -0500 )edit

Question Tools

1 follower


Asked: 2014-05-30 18:14:52 -0500

Seen: 162 times

Last updated: May 30 '14