目录
6.3.1 下载protobuf-cpp-3.13.0.tar.gz
1、安装工具
sudo apt-get update
sudo apt-get install -y python-wstool python-rosdep ninja-build
2、创建工作空间
cd cartographer_ws
wstool init src
3、设置下载地址
wstool merge -t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall
如果提示下载失败,如下图
直接修改 src文件夹下的 .rosinstall
- git:
local-name: cartographer
uri: https://github.com/googlecartographer/cartographer.git
- git:
local-name: cartographer_ros
uri: https://github.com/googlecartographer/cartographer_ros.git
- git:
local-name: ceres-solver
uri: https://github.com/ceres-solver/ceres-solver.git
version: 1.13.0
然后在cartographer_ws文件夹下执行命令
wstool update -t src
正常情况下就可以下载了
4、更新并安装相关功能包
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
5、编译安装
catkin_make_isolated --install --use-ninja
6、填坑
6.1 检查protobuf版本
protoc --version
#显示版本为2.7.0
6.2 查看行文件protoc地址
which protoc
#显示/usr/bin/protoc
6.3 安装proto3
6.3.1 下载protobuf-cpp-3.13.0.tar.gz
https://github.com/protocolbuffers/protobuf/releases
6.3.2 编译
参考:https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
./configure CFLAGS="-fPIC" CXXFLAGS="-fPIC"
make
make check
sudo make install
sudo ldconfig # refresh shared library cach
注:./confiure步骤时一定要加上两个变量参数
./configure CFLAGS="-fPIC" CXXFLAGS="-fPIC"
否则在编译cartographer_rviz时可能会出现如下错误
6.3.3安装完成
正常情况下cartographer就可以顺利编译了,但若还是提示未安装ptoto3,可尝试将/usr/bin/protoc删除,将/usr/local/bin/protoc复制到/usr/bin
sudo cp /usr/local/bin/protoc /usr/bin/
一定要记得备份 /usr/bin/protoc,必要时还原回去。
参考:
https://blog.csdn.net/qq_42145185/article/details/80955894#commentBox