Error in compilation

Respected Professor,
I’m trying to run the command catkin_make in part 6 of ROS-Basics and it’s throwing the following error

Following are my files, with codes:

MyCustomServiceMessage.srv
int32 duration

bool success

CMakeLists.txt
find_package(catkin REQUIRED COMPONENTS
rospy
std_msgs
message_generation
)

add_service_files(
  FILES
  MyCustomServiceMessage.srv
#   Service1.srv
#   Service2.srv
)

generate_messages(
  DEPENDENCIES
  std_msgs  # Or other packages containing msgs
)

catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES my_custom_srv_msg_pkg
 CATKIN_DEPENDS rospy
#  DEPENDS system_lib
)

package.xml
<buildtool_depend>catkin</buildtool_depend>
<build_depend>rospy</build_depend>
<build_export_depend>rospy</build_export_depend>
<exec_depend>rospy</exec_depend>
<build_depend>message_generation</build_depend>
<build_export_depend>message_runtime</build_export_depend>
<exec_depend>message_runtime</exec_depend>
<build_depend>std_msgs</build_depend>
<build_export_depend>std_msgs</build_export_depend>
<exec_depend>std_msgs</exec_depend>

I searched at least 30-40 articles in TheConstruct Forum to get any answer, but none worked for me.
I’m in part 6 now, and when I run catkin_make, it asks for changes, in part 5, in line 10 of unit_4_services/CMakeLists.txt…I went back there, searched for any misspelling. There wasn’t any spelling mistake.
When I run catkin_make there in part 5, it works. But, when I come back to part 6, it throws the above error again.

what’s on line 10 of unit_4_services/CMakeLists.txt?

cmake_minimum_required(VERSION 3.0.2)
project(unit_4_services)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  iri_wam_reproduce_trajectory
  rospy
)

find_package is line 10

And this is the CMakeList.txt file code for my_custom_srv_msg_pkg which is compiling custom message in part 6

cmake_minimum_required(VERSION 3.0.2)
project(my_custom_srv_msg_pkg)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
  rospy
  std_msgs
  message_generation
)


## Generate services in the 'srv' folder
add_service_files(
  FILES
  MyCustomServiceMessage.srv
#   Service1.srv
#   Service2.srv
)

## Generate actions in the 'action' folder
# add_action_files(
#   FILES
#   Action1.action
#   Action2.action
# )

## Generate added messages and services with any dependencies listed here
generate_messages(
  DEPENDENCIES
  std_msgs  # Or other packages containing msgs
)
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES my_custom_srv_msg_pkg
 CATKIN_DEPENDS rospy
#  DEPENDS system_lib
)

Prof @bayodesegun ,
I tried even removing the built files and running catkin_make again. Long story short, I tried every possible solution I could get out there, but nothing I tried worked.

Try this: remove iri_wam_reproduce_trajectory from find_package and compile again.

1 Like

This threw no error. I hope everything else runs smoothly from here after. I can’t thank you enough dear Prof. Bayode @bayodesegun .
Out of curiosity, why removing that package worked.

1 Like

The error message indicated that that package was the cause of the problem.

1 Like