如何修复 ROS 错误:missing cpp_commonConfig.cmake

问题

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

cmake_error_output.txt
CMake Error at /home/uli/dev/Versatile/catkin/install/catkin/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "cpp_common" with
  any of the following names:

    cpp_commonConfig.cmake
    cpp_common-config.cmake

  Add the installation prefix of "cpp_common" to CMAKE_PREFIX_PATH or set
  "cpp_common_DIR" to a directory containing one of the above files.  If
  "cpp_common" provides a separate development package or SDK, be sure it has
  been installed.
Call Stack (most recent call first):
  CMakeLists.txt:8 (find_package)

解决方案

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

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

build_and_source_cpp_common.sh
git clone https://github.com/ros/roscpp_core.git
cd roscpp_core/cpp_common
colcon build
source install/setup.bash

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


Check out similar posts by category: ROS