ros2执行 colon build 遇到错误:Could not find a package configuration file provided by “ament_cmake“

ros2执行 colon build 遇到错误:Could not find a package configuration file provided by "ament_cmake"

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.

问题源于无法用普通权限 colon build(可能由于某些文件是由root权限创建),只能用root权限运行colon build命令,但由于小鱼自动安装时可能没将ros2 的文件source进入 root文件的~/.bashrc中,因此以root权限运行时找不到相应的 ament_cmake 路径,因此报错。

所以解决办法为:

一、直接将source “你的ros2路径(我的为/opt/ros/humble/setup.bash中入root 权限下的 ~/.bashrc中,如图:

二、在终端下输入一下命令:

 source /opt/ros/humble/local_setup.bash

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值