[Actions Quiz] catkin_make error

I got the following error during catkin_make:
Generating .msg files for action actions_quiz/CustomActionMsg /home/user/catkin_ws/src/actions_quiz/action/CustomActionMsg.action
CMake Error at /home/user/catkin_ws/build/actions_quiz/cmake/actions_quiz-genmsg.cmake:3 (message):
Could not find messages which
‘/home/user/catkin_ws/devel/share/actions_quiz/msg/CustomActionMsgAction.msg’
depends on. Did you forget to specify generate_messages(DEPENDENCIES …)?

Cannot locate message [Header] in package [std_msgs] with paths
[[’/home/user/catkin_ws/devel/share/std_msgs/cmake/…/msg’]]
Call Stack (most recent call first):
/opt/ros/noetic/share/genmsg/cmake/genmsg-extras.cmake:307 (include)
actions_quiz/CMakeLists.txt:71 (generate_messages)

However I should already included all necessary dependencies. Not sure what went wrong?

can you post your package.xml and CmakeList.txt, it looks like there is something missing there

CMakeList.txt:

cmake_minimum_required(VERSION 2.8.3)

project(actions_quiz)

find_package(catkin REQUIRED COMPONENTS

std_msgs

actionlib_msgs

sensor_msgs

message_generation

)

add_action_files(

FILES

CustomActionMsg.action

)

generate_messages(

DEPENDENCIES

std_msgs

actionlib_msgs

sensor_msgs

)

catkin_package(

CATKIN_DEPENDS rospy

)

include_directories(

${catkin_INCLUDE_DIRS}

)

package.xml:

<?xml version="1.0"?>

actions_quiz

0.0.0

The actions_quiz package

user

TODO

<buildtool_depend>catkin</buildtool_depend>
<build_depend>actionlib</build_depend>
<build_depend>actionlib_msgs</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_export_depend>actionlib</build_export_depend>
<build_export_depend>actionlib_msgs</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<exec_depend>actionlib</exec_depend>
<exec_depend>actionlib_msgs</exec_depend>
<exec_depend>rospy</exec_depend>

The pasted code here seems to have some display issue, some code is somehow outside of screen display range. However it still includes the points I think…

This error shows that the message Header is not found. Try double checking your dependencies and remove your build and devel folders before compiling again, and then source your worskpace:

cd ~/catkin_ws
rm -rf build/ devel/
catkin_make
source devel/setup.bash
rospack profile

Anyone knows why it is necessary to do so? It’s very counter-intuitive. If there is a problem with a package, the initial catkin_make should have signaled an error not silently exit successfully.
I did as instructions suggested, catkin_make exited without error but rosmsg list | grep Custom was empty. Had to remove build/ and devel/ and rebuild for it to come up in rosmsg list

This happens if you had compiled your package before and you thereafter made changes to it.

Before re-compiling, you need to remove build and devel. Otherwise, your changes (or any errors introduced) might go unnoticed.

1 Like

Thanks, but the build system itself should have managed any re-compilations if sources are changed like make and cmake do.

Well, the developers of catkin_make didn’t think that was super necessary.
You can get around that by creating a bash alias for catkin_make that does that.

2 Likes