「Linux调试错误」CMake Error at /opt/ros/kinetic/share/ros/core/rosbuild/public.cmake:129 (message):

1.问题描述

在编译ORB_SLAM2中Example的ROS时,执行到

  • $ chmod +x build_ros.sh

  • $ ./build_ros.sh

时。报出如下错误:

CMake Error at /opt/ros/kinetic/share/ros/core/rosbuild/public.cmake:129 (message):
  

  Failed to invoke rospack to get compile flags for package 'ORB_SLAM2'.
  Look above for errors from rospack itself.  Aborting.  Please fix the
  broken dependency!

Call Stack (most recent call first):
  /opt/ros/kinetic/share/ros/core/rosbuild/public.cmake:207 (rosbuild_invoke_rospack)
  CMakeLists.txt:4 (rosbuild_init)


-- Configuring incomplete, errors occurred!
See also "/home/tiddy/catkin_ws/src/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found.  Stop.

2.错误原因

未找到,ROS_PACKAGE_PATH路径。

3.解决方法

需要在环境变量中配置ROS_PACKAGE_PATH路径到当前的ROS安装目录下。

(1)打开bashrc文件。

$cd ~
$vim .bashrc

(2)在bashrc文件的最后一行加上下面代码:

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:PATH/ORB_SLAM2/Examples/ROS

#其中PATH是你的工作空间路径(/home/(user名)/catkin_ws/src)

(3)然后在终端执行:

$source ~/.bashrc

(4)再执行:

$sudo rosdep fix-permissions
$rosdep update

问题解决。(详细的ORB_SLAM2编译过程,请看小白其它博客。)

×亲测有效

你可能感兴趣的:(「,LINUX,」)