ros2_foxy cross compile error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ros2_foxy cross compile error

2,993 Views
_距离你
Contributor I

I am using yocto to build imx8mp, (5.4.7.20 version) currently use bitbake imx-robot-system -c poprlate to generate SDK. But I use the current SDK to cross-compile the ROS2 package on the PC and keep reporting errors. How do I do it?

 

CMake Error at /opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:5 (find_package):
By not providing "Findament_cmake_libraries.cmake" in CMAKE_MODULE_PATH
this project has asked CMake to find a package configuration file provided
by "ament_cmake_libraries", but CMake did not find one.

Could not find a package configuration file provided by
"ament_cmake_libraries" with any of the following names:

ament_cmake_librariesConfig.cmake
ament_cmake_libraries-config.cmake

Add the installation prefix of "ament_cmake_libraries" to CMAKE_PREFIX_PATH
or set "ament_cmake_libraries_DIR" to a directory containing one of the
above files. If "ament_cmake_libraries" provides a separate development
package or SDK, be sure it has been installed.
Call Stack (most recent call first):
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include)
CMakeLists.txt:19 (find_package)


---

@

0 Kudos
Reply
8 Replies

2,942 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @_距离你 

Have you tried to compile the package on board directly?

0 Kudos
Reply

2,939 Views
_距离你
Contributor I

I tried to compile ROS2 application on imx8mp board and it was successful. But the problem is that the collaborative development takes a long time to compile on the board and the efficiency is low. We urgently need methods such as cross-compilation to improve efficiency

0 Kudos
Reply

2,933 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

You need add these packages into TOOLCHAIN, currently there is no ament in your SDK

TOOLCHAIN_TARGET_TASK_append = " \
    ament-cmake \
    ament-cmake-auto \
    ament-cmake-core \
    ament-cmake-export-definitions \
    ament-cmake-export-dependencies \
    ament-cmake-export-include-directories \
    ament-cmake-export-interfaces \
    ament-cmake-export-libraries \
    ament-cmake-export-link-flags \
    ament-cmake-export-targets \
    ament-cmake-gmock \
    ament-cmake-google-benchmark \
    ament-cmake-gtest \
    ament-cmake-include-directories \
    ament-cmake-libraries \
    ament-cmake-nose \
    ament-cmake-pytest \
    ament-cmake-python \
    ament-cmake-ros \
    ament-cmake-target-dependencies \
    ament-cmake-test \
    ament-cmake-version \
    ament-lint-auto \
    foonathan-memory-staticdev \
"

TOOLCHAIN_HOST_TASK_append = " \
    nativesdk-ament-package \
    

 

0 Kudos
Reply

2,918 Views
_距离你
Contributor I

1在git上下载yocto项目L5.4.70-2.3.0版本,并且克隆了meta-ros

git clone https://gitee.com/zxd2021-imx/meta-robot-platform.git

git checkout v0.2-L5.4.70-2.3.0

2我根据文档对项目进行了编译生成ROS2 foxy 的镜像和sdk。

编译指令 bitbake imx-robot-system 用来生成烧录到板卡镜像。

bitbake imx-robot-system -c populate_sdk 用来生成交叉编译的SDK。

diff --git a/imx/meta-robot/recipes-core/images/imx-robot-system.bb b/imx/meta-robot/recipes-core/images/imx-robot-system.bb
index 1991ab10..68f9ad31 100644
--- a/imx/meta-robot/recipes-core/images/imx-robot-system.bb
+++ b/imx/meta-robot/recipes-core/images/imx-robot-system.bb
@@ -35,7 +35,7 @@ CORE_IMAGE_EXTRA_INSTALL += " \
${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'weston-xwayland xterm', '', d)} \
${ISP_PKGS} \
"
-IMAGE_INSTALL += " clblast openblas libeigen opencv gmssl-bin"
+IMAGE_INSTALL += " clblast openblas libeigen opencv"

IMAGE_INSTALL += " \
${ML_PKGS} \

3 在我的ubunt20操作系统中 通过ros2 官网文档https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html 安装了二进制版本的ROS2,并通过demo程序验证了安装ros2的正确性。

4 在现有的系统中我安装了编译生成的交叉编译sdk脚本成功的在/opt目录下生成了交叉编译环境。

./imx-robot-xwayland-glibc-x86_64-imx-robot-system-foxy-aarch64-imx8mpevk-toolchain-1.0.sh

 

nxp@ubuntu:/opt/imx-robot-xwayland/1.0$ ls
environment-setup-aarch64-poky-linux sysroots
site-config-aarch64-poky-linux       version-aarch64-poky-linux

5 在原来demo中我删除了编译的中间文件 ,加载交叉编译环境 。重新使用colcon build 编译demo 很不幸的是会提示如下报错

CMake Error at /opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:5 (find_package):
By not providing "Findament_cmake_libraries.cmake" in CMAKE_MODULE_PATH
this project has asked CMake to find a package configuration file provided
by "ament_cmake_libraries", but CMake did not find one.

Could not find a package configuration file provided by
"ament_cmake_libraries" with any of the following names:

  ament_cmake_librariesConfig.cmake
  ament_cmake_libraries-config.cmake

Add the installation prefix of "ament_cmake_libraries" to CMAKE_PREFIX_PATH
or set "ament_cmake_libraries_DIR" to a directory containing one of the
above files. If "ament_cmake_libraries" provides a separate development
package or SDK, be sure it has been installed.
Call Stack (most recent call first):
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include)
CMakeLists.txt:19 (find_package

6 为了解决上述问题我参考网络其他方法 在 imx/meta-robot/recipes-core/images/imx-robot-system.bb 做了如下增加操作

TOOLCHAIN_TARGET_TASK_append = " rclcpp"
TOOLCHAIN_TARGET_TASK_append = " std-msgs"
TOOLCHAIN_TARGET_TASK_append = " geometry-msgs"
TOOLCHAIN_TARGET_TASK_append = " tf2-geometry-msgs"
TOOLCHAIN_TARGET_TASK_append = " cv-bridge"
TOOLCHAIN_TARGET_TASK_append = " image-common"
TOOLCHAIN_TARGET_TASK_append = " image-transport"
TOOLCHAIN_TARGET_TASK_append = " tf2-ros"
TOOLCHAIN_TARGET_TASK_append = " sensor-msgs"
TOOLCHAIN_TARGET_TASK_append = " rosidl-default-generators"
TOOLCHAIN_TARGET_TASK_append = " foonathan-memory-staticdev"
TOOLCHAIN_TARGET_TASK_append = " foonathan-memory-vendor"
TOOLCHAIN_TARGET_TASK_append = " libstdc++-staticdev"
TOOLCHAIN_TARGET_TASK_append = " libgcc-dev"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-auto"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-core"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-definitions"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-dependencies"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-include-directories"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-interfaces"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-libraries"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-link-flags"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-targets"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-gmock"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-gtest"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-include-directories"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-libraries"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-nose"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-pytest"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-python"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-ros"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-target-dependencies"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-test"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-version"
TOOLCHAIN_TARGET_TASK_append = " ament-lint-auto"
TOOLCHAIN_TARGET_TASK_append = " rosidl-typesupport"

TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake nativesdk-ament-cmake-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-libraries nativesdk-ament-cmake-libraries-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-ros nativesdk-ament-cmake-ros-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-definitions nativesdk-ament-cmake-export-definitions-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-include-directories nativesdk-ament-cmake-export-include-directories-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-interfaces nativesdk-ament-cmake-export-interfaces-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-libraries nativesdk-ament-cmake-export-libraries-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-link-flags nativesdk-ament-cmake-export-link-flags-dev"
# TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-targets nativesdk-ament-cmake-export-targets-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-python nativesdk-ament-cmake-python-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-target-dependencies nativesdk-ament-cmake-target-dependencies-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-include-directories nativesdk-ament-cmake-include-directories-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-version nativesdk-ament-cmake-version-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-gmock nativesdk-ament-cmake-gmock-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-gtest nativesdk-ament-cmake-gtest-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-package nativesdk-ament-package-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-rosidl-default-generators nativesdk-rosidl-default-generators-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-python-cmake-module nativesdk-python-cmake-module-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-index-python nativesdk-ament-index-python-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-rosidl-cmake nativesdk-rosidl-cmake-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-rosidl-typesupport-c nativesdk-rosidl-typesupport-c-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-rosidl-typesupport-interface nativesdk-rosidl-typesupport-interface-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-python3-numpy"
# TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-package nativesdk-rosidl-adapter

在imx/meta-ros/meta-ros2-foxy/recipes-core2路径下增加了文件

├── ament-index-python
│   └── ament-index-python_%.bbappend
├── ament-package
│   └── ament-package_%.bbappend
├── domain-coordinator
│   └── domain-coordinator_%.bbappend
├── opencv-cam
│   └── opencv-cam_git.bb
├── python3-lark-parser
│   └── python3-lark-parser_%.bbappend
├── ros2-shared
│   └── ros2-shared_git.bb
├── ros2-tracing
│   ├── ros2trace_1.0.0-2.bb
│   ├── tracetools_1.0.0-2.bb
│   ├── tracetools-launch_1.0.0-2.bb
│   ├── tracetools-read_1.0.0-2.bb
│   ├── tracetools-test_1.0.0-2.bb
│   └── tracetools-trace_1.0.0-2.bb
├── rviz
│   └── rviz-ogre-vendor_%.bbappend
├── spdlog
│   └── spdlog_1.5.0.bb
└── zstd
  └── zstd_1.4.4.bb

7 重新编译后再次执行交叉编译ros2应用包,之前的问题被解决了但是出现了新的问题

CMake Error at /opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_typesupport_c/cmake/get_used_typesupports.cmake:35 (message):
No 'rosidl_typesupport_c' found
Call Stack (most recent call first):
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_typesupport_c/cmake/rosidl_typesupport_c-extras.cmake:8 (get_used_typesupports)
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_typesupport_c/cmake/rosidl_typesupport_cConfig.cmake:41 (include)
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_default_generators/cmake/rosidl_default_generators-extras.cmake:21 (find_package)
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_default_generators/cmake/rosidl_default_generatorsConfig.cmake:41 (include)
CMakeLists.txt:22 (find_package)

8 针对上述问题我做了一些尝试 比如修改 CMAKE_PREFIX_PATH环境变量 ,替换rosidl_typesupport_c 功能包等操作 都没有效果。每次编译sdk时付出的时间大约在1个小时以上,我迫切需要一个魔法来修复当前问题。

针对上述问题,我需要帮忙引导提供更好的思路。

0 Kudos
Reply

2,919 Views
_距离你
Contributor I

1:首先加载了交叉编译的脚本

nxp@ubuntu:~$ . /opt/imx-robot-xwayland/1.0/environment-setup-aarch64-poky-linux 

2 通过find命令查找 rosidl_typesupport_c

nxp@ubuntu:~/ws$ sudo find /opt/imx-robot-xwayland/1.0/ -name rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/std-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/tf2-msgs/0.13.4-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/diagnostic-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/rcl-interfaces/1.0.0-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/rosidl-typesupport-c/1.0.0-1-r0/git/include/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/shape-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/actionlib-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/builtin-interfaces/1.0.0-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/trajectory-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/unique-identifier-msgs/2.1.2-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/rosgraph-msgs/1.0.0-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/sensor-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/composition-interfaces/1.0.0-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/lifecycle-msgs/1.0.0-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/visualization-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/statistics-msgs/1.0.0-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/nav-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/geometry-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/action-msgs/1.0.0-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/stereo-msgs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/rmw-dds-common/1.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/src/debug/std-srvs/2.0.1-1-r0/build/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/lib/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/lib/rosidl_typesupport_c/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/lib/python3.7/site-packages/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_index/resource_index/rosidl_runtime_packages/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_index/resource_index/packages/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_index/resource_index/package_run_dependencies/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_index/resource_index/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_index/resource_index/parent_prefix_path/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/include/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/lib/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/lib/rosidl_typesupport_c/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/lib/python3.7/site-packages/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/share/ament_index/resource_index/rosidl_runtime_packages/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/share/ament_index/resource_index/packages/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/share/ament_index/resource_index/package_run_dependencies/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/share/ament_index/resource_index/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/share/ament_index/resource_index/parent_prefix_path/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/share/rosidl_typesupport_c
/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/include/rosidl_typesupport_c

3 我demo 的cmakelist 中 添加

list(APPEND CMAKE_PREFIX_PATH "/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/lib")
list(APPEND CMAKE_PREFIX_PATH "/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/include")
list(APPEND CMAKE_PREFIX_PATH "/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/lib")
list(APPEND CMAKE_PREFIX_PATH "/opt/imx-robot-xwayland/1.0/sysroots/x86_64-pokysdk-linux/usr/include")

4 重新编译还是报错相同

nxp@ubuntu:~/ws$ colcon build
Starting >>> sineva_nav
--- stderr: sineva_nav                        
CMake Error at /opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_typesupport_c/cmake/get_used_typesupports.cmake:35 (message):
No 'rosidl_typesupport_c' found
Call Stack (most recent call first):
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_typesupport_c/cmake/rosidl_typesupport_c-extras.cmake:8 (get_used_typesupports)
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_typesupport_c/cmake/rosidl_typesupport_cConfig.cmake:41 (include)
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_default_generators/cmake/rosidl_default_generators-extras.cmake:21 (find_package)
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_default_generators/cmake/rosidl_default_generatorsConfig.cmake:41 (include)
CMakeLists.txt:27 (find_package)


---
Failed   <<< sineva_nav [0.99s, exited with code 1]

Summary: 0 packages finished [1.10s]
1 package failed: sineva_nav
1 package had stderr output: sineva_nav
1 package not processed
0 Kudos
Reply

2,956 Views
_距离你
Contributor I
bug
0 Kudos
Reply

2,959 Views
_距离你
Contributor I

11

0 Kudos
Reply

2,873 Views
_距离你
Contributor I

1 Download the yocto project L5.4.70-2.3.0 version on git, and clone meta-ros

git clone https://gitee.com/zxd2021-imx/meta-robot-platform.git

git checkout v0.2-L5.4.70-2.3.0

2 I compiled the project according to the documentation to generate the image and sdk of ROS2 foxy.

The compilation command bitbake imx-robot-system is used to generate the image for burning to the board.

bitbake imx-robot-system -c populate_sdk is used to generate cross-compiled SDK.

diff --git a/imx/meta-robot/recipes-core/images/imx-robot-system.bb b/imx/meta-robot/recipes-core/images/imx-robot-system.bb index 1991ab10 
.. 68f9ad31 100644
--- a/imx/meta-robot/recipes-core/images/imx-robot-system.bb
+++ b/imx/meta-robot/recipes-core/images/imx-robot-system.bb
@@ -35,7 +35,7 @@ CORE_IMAGE_EXTRA_INSTALL += " \
${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'weston-xwayland xterm', '', d)} \
$ {ISP_PKGS} \
"
-IMAGE_INSTALL += " clblast openblas libeigen opencv gmssl-bin"
+IMAGE_INSTALL += " clblast openblas libeigen opencv"

IMAGE_INSTALL += " \
${ML_PKGS} \

3 In my ubunt20 operating system, I installed the binary version of ROS2 through the ros2 official website documentation https://docs....correctness.

4 In the existing system, I installed the compiled and generated cross-compiled sdk script and successfully generated a cross-compiled environment in the /opt directory.

./imx-robot-xwayland-glibc-x86_64-imx-robot-system-foxy-aarch64-imx8mpevk-toolchain-1.0.sh
nxp@ubuntu:/opt/imx-robot-xwayland/1.0$ ls 
environment-setup-aarch64-poky-linux sysroots
site-config-aarch64-poky-linux version-aarch64-poky-linux

5 In the original demo, I deleted the compiled intermediate files and loaded the cross-compilation environment. Re-use colcon build to compile the demo. Unfortunately, the following error will be prompted

CMake Error at /opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_cmake/cmake/ament_cmake_export_dependencies-extras.cmake:5 (find_package): 
By not providing "Findament_cmake_libraries.cmake" in CMAKE_MODULE_PATH
this project has asked CMake to find a package configuration file provided
by "ament_cmake_libraries", but CMake did not find one.

Could not find a package configuration file provided by
"ament_cmake_libraries" with any of the following names:
ament_cmake _librariesConfig.cmake

ament_cmake_libraries -config.cmake

Add the installation prefix of "ament_cmake_libraries" to CMAKE_PREFIX_PATH
or set "ament_cmake_libraries_DIR" to a directory containing one of the
above files. If "ament_cmake_libraries" provides a separate development
package or SDK, be sure it has been installed.
Call Stack (most recent call first):
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/ament_cmake/cmake/ament_cmakeConfig.cmake:41 (include)
CMakeLists.txt:19 (find_package

6 In order to solve the above problems, I refer to other methods on the network and do the following additions in imx/meta-robot/recipes-core/images/imx-robot-system.bb

TOOLCHAIN_TARGET_TASK_append = "rclcpp" 
TOOLCHAIN_TARGET_TASK_append = "std-msgs"
TOOLCHAIN_TARGET_TASK_append = "geometry-msgs"
TOOLCHAIN_TARGET_TASK_append = "tf2-geometry-msgs"

TOOLCHAIN_TARGET_TASK_app end = "cv-bridge"

TOOLCHAIN_TARGET_TASK_append = "image-common"
TOOLCHAIN_TARGET_TASK_append = "image-transport"
TOOLCHAIN_TARGET_TASK_append = "tf2-ros"
TOOLCHAIN_TARGET_TASK_append = "sensor-msgs"
TOOLCHAIN_TARGET_TASK_append = "rosidl-default-generators"
TOOLCHAIN_TARGET_TASK_append = "foonathan-memory-staticdev"
TOOLCHAIN_TARGET_TASK_append = "foonat han-memory-vendor"
TOOLCHAIN_TARGET_TASK_append = " libstdc++-staticdev"
TOOLCHAIN_TARGET_TASK_append = " libgcc-dev"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-auto"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-core"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-definitions"

TOOLCHA IN_TARGET_TASK_append = " ament-cmake-export-dependencies "
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-include-directories"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-interfaces"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-libraries"
TOOLCHAIN_TARGET_TASK_append = " ament -cmake-export-link-flags"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-export-targets"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-gmock"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-gtest "

TOOLCHAIN_TARGET_TASK_append = " ament-cmake-include-directories"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-libraries"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-nose"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-pytest"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-python"

TOOLCHAIN_TARGET_TASK_append = " ament-cmake-ros"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-target-dependenc ies"
TOOLCHAIN_TARGET_TASK_append = " ament- cmake-test"
TOOLCHAIN_TARGET_TASK_append = " ament-cmake-version"
TOOLCHAIN_TARGET_TASK_append = " ament-lint-auto"
TOOLCHAIN_TARGET_TASK_append = " rosidl-typesupport"

TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake nativesdk- ament-cmake-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk -ament-cmake-libraries nativesdk-ament-cmake-libraries-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-ros nativesdk-ament-cmake-ros-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-definitions nativesdk- ament-cmake-export-definitions-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-include-directories nativesdk-ament-cmake-export-include-directories-dev" TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-include-directories-dev"

TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-include- directories nativesdk-ament-cmake-export-interfaces-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-libraries nativesdk-ament-cmake-export-libraries-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-link-flags nativesdk-ament-cmake-export-link-flags-dev"
\# TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-export-targets nativesdk-ament-cmake-export-targets-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-python nativesdk -ament-cmake-python-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-target-dependencies nativesdk-ament-cmake-target-dependencies-dev" TOOLCHAIN_HOST_TASK_append = " nativesdk-ament- cmake-include-directories nativesdk-ament -cmake -include-directories-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-version nativesdk-ament-cmake-version-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-cmake-gmock nativesdk-ament-cmake-gmock-dev"

TOOLCHAIN_HOST_ TASK_append = " nativesdk-ament-cmake-gtest nativesdk-ament-cmake-gtest-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-package nativesdk-ament-package-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-rosidl-default-generators nativesdk-rosidl-default- generators -Dev "
TOOLCHAIN_HOST_TASK_append =" Nativesdk-Python-CMAKE-MODULE NATIVESDK-PYTHON-CMAKE-MODEV "
TOOLCHAIN_HOST_TASK_append =" Nativesdk- AMENT-Index-Python Nativesdk-AMENT-Index-Python-DEV "
TOOLCHAIN_HOST_TASK_append =" Nativesdk-Rosidl- cmake nativesdk-rosidl-cmake-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-rosidl-typesupport-c nativesdk-rosidl-typesupport-c-dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-rosidl-typesupport-interface nativesdk-rosidl-typesupport-interface- dev"
TOOLCHAIN_HOST_TASK_append = " nativesdk-python3-numpy"
\# TOOLCHAIN_HOST_TASK_append = " nativesdk-ament-package nativesdk-rosidl-adapter

Added files under imx/meta-ros/meta-ros2-foxy/recipes-core2 path

├── ament-index-python 
│ └── ament-index-python_%.bbappend
├── ament-package
│ └── ament-package_%.bbappend
├── domain-coordinator
│ └── domain-coordinator_% .bbappend
├── opencv-cam
│ └── opencv-cam_git.bb
├── python3-lark-parser
│ └── python3-lark-parser_%.bbappend
├── ros2-shared
│ └── ros2-shared_git .bb
├── ros2-tracing
│ ├── ros2trace_1.0.0-2.bb
│ ├── tracetools_1.0.0-2.bb
│ ├── tracetools-launch_1.0.0-2.bb
│ ├── tracetools-read_1 .0.0-2.bb
│ ├── tracetools-test_1.0.0-2.bb
│ └── tracetools-trace_1.0.0-2.bb
├── rviz
│ └── rviz-ogre-vendor_%.bbappend
├─ ─ spdlog
│ └── spdlog_1.5.0.bb
└── zstd
└── zstd_1.4.4.bb

7 After recompiling, cross-compile the ros2 application package again, the previous problem is solved but a new problem appears

CMake Error at /opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rsidl_typesupport_c/cmake/get_used_typesupports.cmake:35 (message): 
No 'rosidl_typesupport_c' found
Call Stack (most recent call first):
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_typesupport_c/cmake/rosidl_typesupport_c-extras.cmake:8 (get_used_typesupports)
/opt/imx-robot-xwayland/1.0 /sysroots/aarch64-poky-linux/usr/share/rosidl_typesupport_c/cmake/rosidl_typesupport_cConfig.cmake:41 (include)
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_default_generators/ cmake/rosidl_default_generators-extras.cmake:21 (find_package)
/opt/imx-robot-xwayland/1.0/sysroots/aarch64-poky-linux/usr/share/rosidl_default_generators/cmake/rosidl_default_generatorsConfig.cmake:41 (include)
CMakeList s.txt :22 (find_package)

8 I made some attempts to solve the above problems, such as modifying the CMAKE_PREFIX_PATH environment variable, replacing the rosidl_typesupport_c function package, etc., all of which had no effect. The time spent on compiling the sdk is more than 1 hour every time, and I desperately need a magic to fix the current problem.

In response to the above problems, I need to help guide and provide better ideas.

@xiaodong_zhang

0 Kudos
Reply