No rule to make libpython when using rosidl_generate_interfaces DEPENDENCIES

asked 2022-03-07 16:16:56 -0500

Rufus gravatar image

updated 2022-03-07 16:18:49 -0500

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

edit retag flag offensive close merge delete

Comments

1
Rufus gravatar image Rufus  ( 2022-03-08 05:01:55 -0500 )edit
1

In the short term, you could apt install python3.9-dev to workaround this migration in the interim.

ruffsl gravatar image ruffsl  ( 2022-03-08 18:09:28 -0500 )edit