Failing catkin_make for custom messages topic/services

I keep having the same issue, over and over again, and dunno what’s wrong!

this is the error:
/home/user/catkin_ws/src/service_server_pkg/src/bb8_move_in_square_service_client.cpp:3:55: fatal error: service_server_pkg/MyCustomServiceMessage.h: No such file or directory
compilation terminated.
service_server_pkg/CMakeFiles/bb8_move_in_square_service_client.dir/build.make:62: recipe for target ‘service_server_pkg/CMakeFiles/bb8_move_in_square_service_client.dir/src/bb8_move_in_square_service_client.cpp.o’ failed
make[2]: *** [service_server_pkg/CMakeFiles/bb8_move_in_square_service_client.dir/src/bb8_move_in_square_service_client.cpp.o] Error 1
CMakeFiles/Makefile2:476: recipe for target ‘service_server_pkg/CMakeFiles/bb8_move_in_square_service_client.dir/all’ failed
make[1]: *** [service_server_pkg/CMakeFiles/bb8_move_in_square_service_client.dir/all] Error 2
Makefile:138: recipe for target ‘all’ failed
make: *** [all] Error 2
Invoking “make -j2 -l2” failed

I had the same issue for the topic messages too, saying file not found while doing catkin_make.

Hi @buzatuionelia,

  1. make sure your CMakeLists.txt and package.xml are set up properly you can copy/paste most settings from other tutorials, but be careful to not copy the 2nd line, defining the package.

  2. make sure your scripts are executable with “chmod +x ‘filename’”

  3. after catkin_make, make sure to source ~/catkin_ws/devel/setup.bash in EVERY shell you want to use

I’m doing this in python, so might not be 100% the same, but perhaps it helps


I do agree with the steps indicated by @simon.steinmann91 I think Simon nailed it!

Please @buzatuionelia follow his advice and let us know if that works (or not)

1 Like

Thanks a lot @simon.steinmann91, @rtellez. Is nice getting support on the 15th of August.

I managed to solve it by watching this video
I just had to add add_dependencies(source_file_name package_name_generate_messages_cpp) in the CMakeLists.txt file.

Still remains a mystery why all the repos I checked and all the code I saw before getting mad to solve it, no one had this piece of line within their code.

1 Like

Read the tutorial carefully. Sometimes when there is a task, read a bit further, as important information is explained. It explicitly tells you if you should NOT look further down and try it yourself.