Dynamic reconfigure headers not generated
Summary
Using $ catkin build my_node
, the reconfigure headers are not generated on some computer (even though the build works on others). It just seems like generate_dynamic_reconfigure_options()
is ignored.
More details
I have a node using catkin and a CMakeLists.txt (i.e. not rosbuild), successfully building from an Ubuntu 16.04 docker container. When I follow exactly all the steps of the "working" Dockerfile into a brand new Ubuntu 16.04 install in VirtualBox, catkin fails with the following error:
Errors << my_node:make /root/catkin_ws/logs/my_node/build.make.008.log
In file included from /root/catkin_ws/src/my_node/src/nodes/path_handler_node.cpp:1:0:
/root/catkin_ws/src/my_node/src/nodes/path_handler_node.h:16:50: fatal error: my_node/PathHandlerNodeConfig.h: No such file or directory
compilation terminated.
make[2]: * * * [CMakeFiles/path_handler_node.dir/src/nodes/path_handler_node.cpp.o] Error 1
make[1]: * * * [CMakeFiles/path_handler_node.dir/all] Error 2
make: * * * [all] Error 2
From what I observe in the working config (the docker container), I expect PathHandlerNodeConfig.h
to be generated in devel/my_node/PathHandlerNodeConfig.h
, but it is not. However, cfg/path_handle_node.cfg
is present in the generate_dynamic_reconfigure_options(...)
in the CMakeLists.txt of my_node
, and there are dynamic_reconfigure
build_depend and run_depend in "package.xml". Again, it works on other computers.
One could be the reason for the config file to not get generated? How could I get more information about what is happening? The error I get says that the config header is missing, but there is no complaint at the time of generating it (if generation is ever started). $ catkin build --verbose my_node
doesn't seem to say anything about the dynamic_reconfigure generation, either.
I have created a small test node following this tutorial and the header file is correctly generated, which makes me even more confused: my code works on other platforms, and this platform that fails with my code works for a small example...
UPDATE:
After a lot of testing, I realized that the config headers are generated when I remove the last two commands of the CMakeLists.txt:
add_executable(path_handler_node src/nodes/path_handler_node.cpp)
target_link_libraries(path_handler_node ${catkin_LIBRARIES})
I would expect the config headers to be generated before path_handler_node
gets compiled (I guess that's the whole point, right?). And because they are not, I get the build error above.
And the problem is really that somehow, the headers are not generated at the right time: if I comment out the two lines above and build, I get the headers generated. Then, if put back the two lines above and compile again, it works...