No rule to make libpython when using rosidl_generate_interfaces DEPENDENCIES
I'm trying to build a package in Docker with ros2 rolling.
My Dockerfile
is as follows
# syntax=docker.io/docker/dockerfile:1.3.1
# Requires https://github.com/moby/buildkit/pull/2089/commits/aa467196bdd5a5d8dd4fe805d590906d81619cdb
ARG ROS_DISTRO="rolling"
ARG WORKSPACE_NAME="ros2_workspace"
FROM ros:$ROS_DISTRO
ARG WORKSPACE_NAME
RUN --mount=type=bind,target=/${WORKSPACE_NAME} --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt apt update && rosdep update && rosdep install -iy --from-paths /${WORKSPACE_NAME}
ENTRYPOINT ["/ros_entrypoint.sh"]
My CMakeLists.txt
is as follows
cmake_minimum_required(VERSION 3.5)
project(my_package)
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)
set(msg_files
msg/Num.msg
)
rosidl_generate_interfaces(${PROJECT_NAME}
${msg_files}
DEPENDENCIES std_msgs # Removing this line fixes the issue
)
ament_export_dependencies(rosidl_default_runtime)
ament_package()
When I run colcon build
, I get the following error.
gmake[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libpython3.9.so', needed by 'libmy_package__rosidl_generator_c.so'. Stop.
gmake[1]: *** [CMakeFiles/Makefile2:205: CMakeFiles/my_package__rosidl_generator_c.dir/all] Error 2
Removing the DEPENDENCIES line solves the issue but eventually I'll need to have dependencies.
I've made sure to have run rosdep install
and source /opt/ros/rolling/setup.bash
Any help is greatly appreciated
Probably related to Preparing for Rolling sync –delayed by Python 3.10 transition–.
Related: https://answers.ros.org/question/3971...
In the short term, you could apt install
python3.9-dev
to workaround this migration in the interim.