I am getting this error when attempting to build my custom ros2 msg. I followed this tutorial on creating a custom ros2 msg (https://docs.ros.org/en/crystal/Tutorials/Custom-ROS2-Interfaces.html), but when i get to the final step of running:
colcon build --packages-select mbs_ros_msgs
I get the following error:
root@docker-desktop:/home/ros2_ws# colcon build --packages-select mbs_ros_msgs
Starting >>> mbs_ros_msgs
--- stderr: mbs_ros_msgs
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_c/mbs_ros_msgs/msg/detail/mbsgpssync__functions.h:19,
from /home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_c/mbs_ros_msgs/msg/detail/mbsgpssync__functions.c:4:
/home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_c/mbs_ros_msgs/msg/detail/mbsgpssync__struct.h:22:10: fatal error: mbs_ros_msgs/msg/detail/header__struct.h: No such file or directory
22 | #include "mbs_ros_msgs/msg/detail/header__struct.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_c/mbs_ros_msgs/msg/detail/mbsephtoa__functions.h:19,
from /home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_c/mbs_ros_msgs/msg/detail/mbsephtoa__functions.c:4:
/home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_c/mbs_ros_msgs/msg/detail/mbsephtoa__struct.h:22:10: fatal error: mbs_ros_msgs/msg/detail/header__struct.h: No such file or directory
22 | #include "mbs_ros_msgs/msg/detail/header__struct.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/mbs_ros_msgs__rosidl_generator_c.dir/build.make:167: CMakeFiles/mbs_ros_msgs__rosidl_generator_c.dir/rosidl_generator_c/mbs_ros_msgs/msg/detail/mbsgpssync__functions.c.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/mbs_ros_msgs__rosidl_generator_c.dir/build.make:153: CMakeFiles/mbs_ros_msgs__rosidl_generator_c.dir/rosidl_generator_c/mbs_ros_msgs/msg/detail/mbsephtoa__functions.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:213: CMakeFiles/mbs_ros_msgs__rosidl_generator_c.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_typesupport_cpp/mbs_ros_msgs/msg/mbsephtoa__type_support.cpp:7:
/home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_cpp/mbs_ros_msgs/msg/detail/mbsephtoa__struct.hpp:20:10: fatal error: 'mbs_ros_msgs/msg/detail/header__struct.hpp' file not found
#include "mbs_ros_msgs/msg/detail/header__struct.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_typesupport_cpp/mbs_ros_msgs/msg/mbsgpssync__type_support.cpp:7:
/home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_cpp/mbs_ros_msgs/msg/detail/mbsgpssync__struct.hpp:20:10: fatal error: 'mbs_ros_msgs/msg/detail/header__struct.hpp' file not found
#include "mbs_ros_msgs/msg/detail/header__struct.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
1 error generated.
gmake[2]: *** [CMakeFiles/mbs_ros_msgs__rosidl_typesupport_cpp.dir/build.make:122: CMakeFiles/mbs_ros_msgs__rosidl_typesupport_cpp.dir/rosidl_typesupport_cpp/mbs_ros_msgs/msg/mbsephtoa__type_support.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/mbs_ros_msgs__rosidl_typesupport_cpp.dir/build.make:136: CMakeFiles/mbs_ros_msgs__rosidl_typesupport_cpp.dir/rosidl_typesupport_cpp/mbs_ros_msgs/msg/mbsgpssync__type_support.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:395: CMakeFiles/mbs_ros_msgs__rosidl_typesupport_cpp.dir/all] Error 2
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_typesupport_fastrtps_cpp/mbs_ros_msgs/msg/detail/dds_fastrtps/mbsgpssync__type_support.cpp:4:
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_typesupport_fastrtps_cpp/mbs_ros_msgs/msg/detail/mbsgpssync__rosidl_typesupport_fastrtps_cpp.hpp:11:
/home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_cpp/mbs_ros_msgs/msg/detail/mbsgpssync__struct.hpp:20:10: fatal error: 'mbs_ros_msgs/msg/detail/header__struct.hpp' file not found
#include "mbs_ros_msgs/msg/detail/header__struct.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_typesupport_introspection_cpp/mbs_ros_msgs/msg/detail/mbsgpssync__type_support.cpp:12:
/home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_cpp/mbs_ros_msgs/msg/detail/mbsgpssync__struct.hpp:20:10: fatal error: 'mbs_ros_msgs/msg/detail/header__struct.hpp' file not found
#include "mbs_ros_msgs/msg/detail/header__struct.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
gmake[2]: *** [CMakeFiles/mbs_ros_msgs__rosidl_typesupport_introspection_cpp.dir/build.make:144: CMakeFiles/mbs_ros_msgs__rosidl_typesupport_introspection_cpp.dir/rosidl_typesupport_introspection_cpp/mbs_ros_msgs/msg/detail/mbsgpssync__type_support.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_typesupport_fastrtps_cpp/mbs_ros_msgs/msg/detail/dds_fastrtps/mbsephtoa__type_support.cpp:4:
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_typesupport_fastrtps_cpp/mbs_ros_msgs/msg/detail/mbsephtoa__rosidl_typesupport_fastrtps_cpp.hpp:11:
/home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_cpp/mbs_ros_msgs/msg/detail/mbsephtoa__struct.hpp:20:10: fatal error: 'mbs_ros_msgs/msg/detail/header__struct.hpp' file not found
#include "mbs_ros_msgs/msg/detail/header__struct.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/ros2_ws/build/mbs_ros_msgs/rosidl_typesupport_introspection_cpp/mbs_ros_msgs/msg/detail/mbsephtoa__type_support.cpp:12:
/home/ros2_ws/build/mbs_ros_msgs/rosidl_generator_cpp/mbs_ros_msgs/msg/detail/mbsephtoa__struct.hpp:20:10: fatal error: 'mbs_ros_msgs/msg/detail/header__struct.hpp' file not found
#include "mbs_ros_msgs/msg/detail/header__struct.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
gmake[2]: *** [CMakeFiles/mbs_ros_msgs__rosidl_typesupport_introspection_cpp.dir/build.make:130: CMakeFiles/mbs_ros_msgs__rosidl_typesupport_introspection_cpp.dir/rosidl_typesupport_introspection_cpp/mbs_ros_msgs/msg/detail/mbsephtoa__type_support.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:369: CMakeFiles/mbs_ros_msgs__rosidl_typesupport_introspection_cpp.dir/all] Error 2
1 error generated.
gmake[2]: *** [CMakeFiles/mbs_ros_msgs__rosidl_typesupport_fastrtps_cpp.dir/build.make:144: CMakeFiles/mbs_ros_msgs__rosidl_typesupport_fastrtps_cpp.dir/rosidl_typesupport_fastrtps_cpp/mbs_ros_msgs/msg/detail/dds_fastrtps/mbsgpssync__type_support.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
1 error generated.
gmake[2]: *** [CMakeFiles/mbs_ros_msgs__rosidl_typesupport_fastrtps_cpp.dir/build.make:130: CMakeFiles/mbs_ros_msgs__rosidl_typesupport_fastrtps_cpp.dir/rosidl_typesupport_fastrtps_cpp/mbs_ros_msgs/msg/detail/dds_fastrtps/mbsephtoa__type_support.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:291: CMakeFiles/mbs_ros_msgs__rosidl_typesupport_fastrtps_cpp.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed <<< mbs_ros_msgs [2.07s, exited with code 2]
Summary: 0 packages finished [2.16s]
1 package failed: mbs_ros_msgs
1 package had stderr output: mbs_ros_msgs
This is my CMakeLists.txt from my custom message package:
cmake_minimum_required(VERSION 3.8)
project(mbs_ros_msgs)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/MBSEPHTOA.msg"
"msg/MBSGPSSYNC.msg"
DEPENDENCIES std_msgs
)
ament_export_dependencies(rosidl_default_runtime)
ament_package()
And this is my package.xml file:
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>mbs_ros_msgs</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="gilbertogonzalez@todo.todo">gilbertogonzalez</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<depend>std_msgs</depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<export>
<build_type>ament_cmake</build_type>
</export>
</package>
I can't imagine that the issue is in any of the above files. I am not sure why I am seeing this error. Please let me know if you need further information, any help would be greatly appreciated!