0
$\begingroup$

I am trying to compile multiple packages in ros2 humble. I am trying to compile the ackerman messages package as well as the franka ros2 meta-package (more specifically, the franka_msgs package). I see that there are custom messages and services involved. I followed the instructions to build the franka package. I also simply cloned the ackerman package into my ros 2 workspace like any other package. Both return this same error:

--- stderr: ackermann_msgs                                                                                                                                                                            
gmake[1]: *** No rule to make target 'ackermann_msgs__py/CMakeFiles/ackermann_msgs__py.dir/all', needed by 'CMakeFiles/ackermann_msgs__rosidl_generator_py.dir/all'.  Stop.
gmake[1]: *** Waiting for unfinished jobs....
gmake: *** [Makefile:146: all] Error 2
---

I looked in the cmake files and they both appear to create messages correctly. I saw that there were changes recently from Foxy to Humble, but I don't see how they are major breaking changes. It may be that I simply don't understand how to compile messages in Humble. How do you compile custom messages and services (and actions too) in ROS2 Humble? Here are some resources I have referenced:

https://answers.ros.org/question/390451/colcon-build-fails-on-anything-with-messages-now-after-ubuntu-2004-foxy-sudo-apt-upgrade/
https://answers.ros.org/question/401345/ros2-humble-unable-to-compile-custom-srv-which-depends-on-msg/
https://stackoverflow.com/questions/71970577/ros2-custom-messages-build-failed-with-invalidfielddefinition
https://robotics.stackexchange.com/questions/23171/creating-a-custom-msg-in-ros2
$\endgroup$
1
  • $\begingroup$ Is there a reason you need to compile these from source instead of using the released packages from the Build Farm (aka apt packages)? $\endgroup$ Sep 26, 2022 at 21:30

1 Answer 1

1
$\begingroup$

In the Humble Release Notes it is stated that rosidl_target_interfaces() is deprecated and should be instead used rosidl_get_typesupport_target() and then target_link_libraries().

To build the package you can use the following modified CMake:

cmake_minimum_required(VERSION 3.5)

project(ackermann_msgs)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake REQUIRED)
find_package(rosidl_default_generators REQUIRED)

find_package(std_msgs REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
  "msg/AckermannDrive.msg"
  "msg/AckermannDriveStamped.msg"
  DEPENDENCIES std_msgs
  ADD_LINTER_TESTS
)

rosidl_get_typesupport_target(${PROJECT_NAME}_typesupport_c
  ${PROJECT_NAME}
  "msg/AckermannDrive"
  "msg/AckermannDriveStamped"
  DEPENDENCIES std_msgs
)

ament_export_dependencies(rosidl_default_runtime)

ament_package()
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.