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

catkin_make started failing to generate .h from .msg

asked 2013-05-03 17:07:52 -0500

130s gravatar image

updated 2014-01-28 17:16:26 -0500

ngrennan gravatar image

I have a C++ pkg that used to build successfully by cakin_make. But recently building starts to fail often, not always, with an error message:

~/catkinws_prv:$ rm -fR build/ devel/
~/catkinws_prv:$ catkin_make -j2
~/catkinws_prv/src/rqt_common_plugins/rqt_marble/src/rqt_marble/bridge_ros_marble.cpp:39:33: fatal error: rqt_marble/RouteGps.h: No such file or directory
compilation terminated.
Scanning dependencies of target rqt_marble_gencpp
[ 55%] Generating C++ code from rqt_marble/RouteGps.msg
[ 55%] Built target rqt_marble_gencpp
Scanning dependencies of target rqt_marble_genlisp
[ 61%] Generating Lisp code from rqt_marble/RouteGps.msg
[ 61%] Built target rqt_marble_genlisp
Scanning dependencies of target rqt_marble_genpy
[ 66%] Generating Python from MSG rqt_marble/RouteGps
[ 72%] Generating Python msg for rqt_marble
[ 72%] Built target rqt_marble_genpy
[ 77%] Building CXX object rqt_common_plugins/rqt_marble/CMakeFiles/rqt_marble.dir/include/rqt_marble/moc_bridge_ros_marble.cxx.o
The bug is not reproducible, so it is likely a hardware or OS problem.
make[2]: *** [rqt_common_plugins/rqt_marble/CMakeFiles/rqt_marble.dir/src/rqt_marble/bridge_ros_marble.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [rqt_common_plugins/rqt_marble/CMakeFiles/rqt_marble.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

Direct cause of the problem is clear: RouteGps.h is not generated from RouteGps.msg. But why?

System dependency should be correctly installed (as I said, catkin_make sometimes passes).

Because of this line in the error message above,

The bug is not reproducible, so it is likely a hardware or OS problem.

I thought my machine may have an issue, but as I cite later, the similar error occurs on buildfarm.

I first suspected my recent commits do something wrong, but even the commit that built well like this initial commit fails with the same error.

Anything wrong?

$ dpkg -p ros-groovy-catkin 
Version: 0.5.65-3quantal-20130325-0722-+0000
$ dpkg -p python-catkin-pkg
Version: 0.1.11-1

And although I'm not sure the correlation, Jenkins has also started returning similar error (with my latest commit):

In file included from /tmp/test_repositories/src_repository/rqt_common_plugins/rqt_marble/include/rqt_marble/marble_plugin.h:42:0,
                 from /tmp/test_repositories/src_repository/rqt_common_plugins/rqt_marble/src/rqt_marble/marble_plugin.cpp:48:
/tmp/test_repositories/src_repository/rqt_common_plugins/rqt_marble/include/rqt_marble/bridge_ros_marble.h:12:33: fatal error: rqt_marble/RouteGps.h: No such file or directory

Update 5/7/2013) After adding add_dependencies I still saw the same issue. Eventually I moved a .msg file to another pkg and so far it builds nicely. The link that @Chad Rockey shared helped.

Update 5/14/13) Have been built fine locally, but jenkins has kept failing for the last 2 weeks, complaining the .h file from .msg is not found, although the console output implies it is built. I opened up a new question for this.

edit retag flag offensive close merge delete



Keeping all your messages in a separate package is a good idea, anyway.

joq gravatar image joq  ( 2013-05-07 04:20:06 -0500 )edit

I can't discern your package dependency tree from the question. Perhaps there is a third intermediate package that also requires add_dependencies()?

joq gravatar image joq  ( 2013-05-14 06:08:11 -0500 )edit

@joq I've moved the latest update to new question, and there we've found that I forgot to include a depended pkg in find_package.

130s gravatar image 130s  ( 2013-05-14 17:22:39 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-05-04 04:02:24 -0500

joq gravatar image

updated 2013-05-15 06:26:17 -0500

I suspect you require an explicit dependency on the generated message targets, to ensure things always get built in the correct order:

add_dependencies(your_program ${catkin_EXPORTED_TARGETS})

In your example maybe you just need this:

add_dependencies(your_program ${rqt_marble_EXPORTED_TARGETS})

NOTE: catkin compiles targets in parallel quite aggressively. The build machines tend to have more processors than most people's development systems. So, they may uncover missing dependencies that did not occur during development.

edit flag offensive delete link more


Thx for an even clearer answer. I added add_dependencies and locally builds w/o error. Now I'm waiting for how jenkins handles it...

130s gravatar image 130s  ( 2013-05-06 04:38:49 -0500 )edit

I had a similar build fail and your line add_dependencies(your_program ${catkin_EXPORTED_TARGETS}) solved my problem. Thanks!

basheersubei gravatar image basheersubei  ( 2014-08-12 13:07:31 -0500 )edit

answered 2013-05-03 17:56:02 -0500

Chad Rockey gravatar image

What happens if you run catkin_make again for a second/third time without cleaning? Does it complete the compile?

Sometimes you need to list it as a dependency, even though it's in another package:

edit flag offensive delete link more


Yeah I've already found that re-running catkin_make generates the file I want...perfect WORKAROUND.

130s gravatar image 130s  ( 2013-05-03 18:43:14 -0500 )edit

I think @joq's answer should be the selected one, it is the correct way to fix this, running catkin_make multiple times is just suppressing or working around the actual problem.

William gravatar image William  ( 2013-05-07 06:57:56 -0500 )edit

If catkin_make succeeds on another pass, it is a good indicator that the fix I link to will work. If it doesn't, there is another issue.

Chad Rockey gravatar image Chad Rockey  ( 2013-05-07 10:27:52 -0500 )edit

As I've updated my OP, what's so far working for me (on local machine. I'm not yest sure about buildfarm since I'm still seeing a build failure on jenkins) is that link; having 2 pkgs where 1 pkg contains .msg on which the other pkg depends.

130s gravatar image 130s  ( 2013-05-07 13:31:43 -0500 )edit

Question Tools


Asked: 2013-05-03 17:07:52 -0500

Seen: 8,387 times

Last updated: May 15 '13