ROS2 + colcon build 常见的一些报错
(1)colcon build ERROR: Unknown CMake command "rosidl_get_typesupport_target"
demos: GitHub - ros2/demos
ROS2在demos执行colcon build的时候报错,
> colcon build
--- stderr: logging_demo
CMake Error at CMakeLists.txt:34 (rosidl_get_typesupport_target):
Unknown CMake command "rosidl_get_typesupport_target".
原因,
忘记添加版本信息,版本错误。
解决办法,
重新下载,
git clone -b galactic-devel https://github.com/ros2/demos.git
或
git checkout galactic-devel
--------------------------------------------
(2)colcon build ERROR: Could not find a package configuration file provided by "ament_cmake" with any ...
--- stderr: rclpy
CMake Error at CMakeLists.txt:26 (find_package):
By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"ament_cmake", but CMake did not find one.
Could not find a package configuration file provided by "ament_cmake" with
any of the following names:
ament_cmakeConfig.cmake
ament_cmake-config.cmake
Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set
"ament_cmake_DIR" to a directory containing one of the above files. If
"ament_cmake" provides a separate development package or SDK, be sure it
has been installed.
原因,
忘记导入启动信息
解决办法,
call C:\opt\ros\galactic\x64\setup.bat
--------------------------------------------