如何修复 ROS2 错误:catkinConfig.cmake

问题

尝试使用 colcon build 构建某些 ROS 包时,你看到如下错误消息

cmake_error_catkin.txt
CMake Error at CMakeLists.txt:6 (find_package):
  By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "catkin", but
  CMake did not find one.

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

    catkinConfig.cmake
    catkin-config.cmake

  Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
  "catkin_DIR" to a directory containing one of the above files.  If "catkin"
  provides a separate development package or SDK, be sure it has been
  installed.

解决方案

Catkin 目前没有以适合从官方 ROS2 源安装的形式提供。

因此,克隆仓库,使用 colcon 构建它,然后在构建你的包之前 source install/setup.bash

build_catkin.sh
git clone https://github.com/ros/catkin.git
cd catkin
colcon build
source install/setup.bash

之后(在同一个 shell 中),再次使用 colcon build 构建你的其他包。


Check out similar posts by category: ROS