meta-ros icon indicating copy to clipboard operation
meta-ros copied to clipboard

Python packages missing

Open andy9a9 opened this issue 1 year ago • 1 comments

Dear community!

I've found some missing packages during ROS (iron) integration. I built the Yocto's SDK with ROS layer and installed it on Ubuntu 22.04 with the same ROS version.

  • first missing package was empy
    • CMake Error at /home/project/ros/sdk/sysroots/cortexa72-cortexa53-xilinx-linux/usr/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:59 (message):
      
        execute_process(/home/project/ros/sdk/sysroots/x86_64-oesdk-linux/usr/bin/python3.10
        -m rosidl_adapter --package-name plt_interfaces --arguments-file
        /home/project/ros/plt_ros_poc/build-imx8/build/plt_interfaces/rosidl_adapter__arguments__plt_interfaces.json
        --output-dir
        /home/project/ros/plt_ros_poc/build-imx8/build/plt_interfaces/rosidl_adapter/plt_interfaces
        --output-file
        /home/project/ros/plt_ros_poc/build-imx8/build/plt_interfaces/rosidl_adapter/plt_interfaces.idls)
        returned error code 1:
      
        Traceback (most recent call last):
      
          File "/home/project/ros/sdk/sysroots/x86_64-oesdk-linux/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
            return _run_code(code, main_globals, None,
          File "/home/project/ros/sdk/sysroots/x86_64-oesdk-linux/usr/lib/python3.10/runpy.py", line 86, in _run_code
            exec(code, run_globals)
          File "/opt/ros/iron/lib/python3.10/site-packages/rosidl_adapter/__main__.py", line 19, in <module>
            sys.exit(main())
          File "/opt/ros/iron/lib/python3.10/site-packages/rosidl_adapter/main.py", line 53, in main
            abs_idl_file = convert_to_idl(
          File "/opt/ros/iron/lib/python3.10/site-packages/rosidl_adapter/__init__.py", line 18, in convert_to_idl
            from rosidl_adapter.msg import convert_msg_to_idl
          File "/opt/ros/iron/lib/python3.10/site-packages/rosidl_adapter/msg/__init__.py", line 16, in <module>
            from rosidl_adapter.resource import expand_template
          File "/opt/ros/iron/lib/python3.10/site-packages/rosidl_adapter/resource/__init__.py", line 19, in <module>
            import em
      
        ModuleNotFoundError: No module named 'em'
      
      Call Stack (most recent call first):
        /home/project/ros/sdk/sysroots/cortexa72-cortexa53-xilinx-linux/usr/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
        CMakeLists.txt:14 (rosidl_generate_interfaces)
      
  • the next problem was with catkin_pkg
    • Traceback (most recent call last):
        File "/home/project/ros/sdk/sysroots/cortexa72-cortexa53-xilinx-linux/usr/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py", line 22, in <module>
          from catkin_pkg.package import parse_package_string
      ModuleNotFoundError: No module named 'catkin_pkg'
      CMake Error at /home/project/ros/sdk/sysroots/cortexa72-cortexa53-xilinx-linux/usr/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:95 (message):
      
        execute_process(/home/project/ros/sdk/sysroots/x86_64-oesdk-linux/usr/bin/python3.10
        /home/project/ros/sdk/sysroots/cortexa72-cortexa53-xilinx-linux/usr/share/ament_cmake_core/cmake/core/package_xml_2_cmake.py
        /home/project/ros/plt_ros_poc/src/plt_interfaces/package.xml
        /home/project/ros/plt_ros_poc/build-imx8/build/plt_interfaces/ament_cmake_core/package.cmake)
        returned error code 1
      Call Stack (most recent call first):
        /home/project/ros/sdk/sysroots/cortexa72-cortexa53-xilinx-linux/usr/share/ament_cmake_core/cmake/core/ament_package_xml.cmake:49 (_ament_package_xml)
        /home/project/ros/sdk/sysroots/cortexa72-cortexa53-xilinx-linux/usr/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:226 (ament_package_xml)
        CMakeLists.txt:14 (rosidl_generate_interfaces)
      
  • the same problem with pyparsing and lark

I've just fixed it explicitly installing a nativesdk- packages' variants, but I don't think so, that's a good way.

# nativesdk-packagegroup-sdk-host.bbappend
RDEPENDS:${PN} += " \
    nativesdk-python3-catkin-pkg \
    nativesdk-python3-empy \
    nativesdk-python3-lark-parser \
    nativesdk-python3-pyparsing \
"

Now the question is, why this happened. From the callstack I can see, that the the correct python interpreter is used /home/project/ros/sdk/sysroots/x86_64-oesdk-linux/usr/bin/python3.10, but he should search in site-packages of target sysroot, nope?

So what's really wrong here? Thanks

andy9a9 avatar Jun 07 '24 08:06 andy9a9

There has been a lot of good work around building Yocto SDKs. Most of the people involved have used BBCLASSEXTEND = "native nativesdk" to ensure that all necessary packages are included.

I suspect that the SDK intentionally avoids using the Python modules for the target (and possibly avoids the host Python modules as well). Definitely something worth looking into. It is the direction I want to go next once I get ros-image-world building regularly with CI.

robwoolley avatar Jun 26 '24 11:06 robwoolley