ROS2 colcon build 遇到问题

        当使用小鱼的教程时 colon build 遇到错误: 

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/foxy/setup.bash中入root 权限下的 ~/.bashrc中,如图:

         二、在root权限下输入一下命令:

//路径因人而异
source /opt/ros/foxy/setup.bash

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值