Skip to content

A problem: Path pollution occurs when cross-compiling the ROS 2 message package #1553

@ctgulzh

Description

@ctgulzh

Hello everyone!
I recently used the petalinux2022.2 tool on an X86 host to cross-compile a custom ROS 2 message package for integration into a boot image for an embedded device (Xilinx MPSoC device) built using petalinux2022.2.
I'm currently encountering a cross-compilation error with the following error message:
CMake Error in CMakeLists.txt: | Target "mnist_cnn_interface__rosidl_generator_py" | INTERFACE_INCLUDE_DIRECTORIES property contains path: | "/home/lzh/lzh/petalinux/kr260_xsa_ros/build/tmp/work/cortexa72-cortexa53-xilinx-linux/mnist-cnn-interface/0.1.0-r0/recipe-sysroot-native/usr/lib/python3.9/site-packages/numpy/core/include" | | which is prefixed in the source directory.
My initial analysis suggests a path contamination issue. The rosidl_generate_interfaces metapackage uses the NumPy library in the host development environment's Python path when generating the Python interface language from the message package source code (the rosidl_generate_interfaces metapackage is designed for compiling message packages on the host). Instead of using the NumPy library in the embedded device boot image in the path /petalinux/kr260_xsa_ros/build/tmp/work/cortexa72-cortexa53-xilinx-linux/mnist-cnn-interface/0.1.0-r0/recipe-sysroot/usr/include/python3.9, it actually should.
Is my suspicion correct? If so, how can I resolve this Python path contamination issue during cross-compilation?
Attached is the full error message. I look forward to your response!
cmake-error.txt

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