Skip to content

sensor_diagnostics: Docker build fails — missing ROS2MedkitCompat.cmake #28

@victorsolaz

Description

@victorsolaz

Which demo

sensor_diagnostics

Steps to reproduce

  1. Clone the repository
  2. Run cd demos/sensor_diagnostics && bash run-demo.sh
  3. Docker build fails during colcon build at the ros2_medkit_serialization package

Expected behavior

The Docker image builds successfully and the demo launches.

Actual behavior

The build fails because ros2_medkit_serialization (and potentially other packages) cannot find the ROS2MedkitCompat CMake module. The error occurs during the CMake configure step:

CMake Error at CMakeLists.txt (include):
  include could not find requested file:
    ROS2MedkitCompat

Root cause

The Dockerfile clones ros2_medkit, extracts individual packages from ros2_medkit/src/ into ${COLCON_WS}/src/, and then deletes the entire clone with rm -rf ros2_medkit. However, ros2_medkit/cmake/ROS2MedkitCompat.cmake — a shared CMake module referenced by multiple packages via ../../cmake relative paths — is not preserved before deletion.

Proposed fix

Add a line to preserve the CMake module before removing the clone:

 RUN git clone --depth 1 https://github.com/selfpatch/ros2_medkit.git && \
     mv ros2_medkit/src/ros2_medkit_gateway . && \
     mv ros2_medkit/src/ros2_medkit_serialization . && \
     mv ros2_medkit/src/ros2_medkit_msgs . && \
     mv ros2_medkit/src/ros2_medkit_fault_manager . && \
     mv ros2_medkit/src/ros2_medkit_fault_reporter . && \
     mv ros2_medkit/src/ros2_medkit_diagnostic_bridge . && \
+    mkdir -p ${COLCON_WS}/cmake && mv ros2_medkit/cmake/ROS2MedkitCompat.cmake ${COLCON_WS}/cmake/ && \
     rm -rf ros2_medkit

This places ROS2MedkitCompat.cmake at ${COLCON_WS}/cmake/, which is exactly where the relative ../../cmake paths from packages in ${COLCON_WS}/src/<pkg>/ resolve to. The fix has been tested locally and the demo builds and runs correctly.

Environment

  • ROS 2 distro: Jazzy
  • OS: Ubuntu 24.04 on WSL 2
  • ros2_medkit version: latest (HEAD of main)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions