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