安装cartographer出现的问题及解决方法

环境:Ubuntu16.04
安装参考这一篇文章:https://www.ncnynl.com/archives/201702/1369.html

1 安装依赖

sudo apt-get install -y google-mock libboost-all-dev libeigen3-dev libgflags-dev libgoogle-glog-dev liblua5.2-dev libprotobuf-dev libsuitesparse-dev libwebp-dev ninja-build protobuf-compiler python-sphinx ros-kinetic-tf2-eigen libatlas-base-dev libsuitesparse-dev liblapack-dev

2 安装 wstool 和 rosdep

sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build

3 创建工作空间 ‘catkin_ws’

mkdir catkin_ws
cd catkin_ws
wstool init src

4 Merge the cartographer_turtlebot.rosinstall file and fetch code for dependencies

wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_turtlebot/master/cartographer_turtlebot.rosinstall

gedit src/.rosinstall

#######更改ceres-solver中地址改为下面的地址:
#######>>uri: https://github.com/ceres-solver/ceres-solver.git

wstool update -t src

5 安装 deb 依赖

rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y

6 Build and install

catkin_make_isolated --install --use-ninja
source install_isolated/setup.bash

在我执行到catkin_make_isolated --install --use-ninja的时候出现了问题:
ninja: build stopped: subcommand failed.
<== Failed to process package ‘cartographer’:
Command ‘[’/home/funstep/catkin_ws/install_isolated/env.sh’, ‘ninja’, ‘-j8’, ‘-l8’]’ returned non-zero exit status 1
Reproduce this error by running:
==> cd /home/funstep/catkin_ws/build_isolated/cartographer && /home/funstep/catkin_ws/install_isolated/env.sh ninja -j8 -l8
Command failed, exiting.

查了网上的资料是protoc版本的问题. 卸载2.6.1的版本, 安装最新的版本(需要3.0以上的版本),例如我安装的已经更新到了3.9.0. 这些资料网上都有.
装完在.bashrc中添加了环境变量.
####### add protobuf lib path ########
export LD_LIBRARY_PATH=KaTeX parse error: Expected 'EOF', got '#' at position 33: …usr/local/lib/ #̲(静态库搜索路径) 程序编译期…LIBRARY_PATH:/usr/local/lib/
#执行程序搜索路径
export PATH=KaTeX parse error: Expected 'EOF', got '#' at position 22: …usr/local/bin/ #̲c程序头文件搜索路径 expo…C_INCLUDE_PATH:/usr/local/include/
#c++程序头文件搜索路径
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/local/include/
#pkg-config 路径
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
######################################

安装完protoc后还是有问题, 检查了一下路径, 安装在了usr/local/bin 了, 而cartographer检查路径是 usr/bin , 我就直接简单粗暴复制了过去.
sudo cp /usr/local/bin/protoc /usr/bin

再次执行catkin_make_isolated --install --use-ninja 问题解决啦, 开心撒花~

你可能感兴趣的:(安装cartographer出现的问题及解决方法)