Ubuntu16.04重装protobuf2.6.1版本

重装protobuf2.6.1版本

error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which
之前装cartographer的时候,protobuf的版本升级到了3.4版本,然后最近再搞一些gazebo的仿真,下了一些包,好多编译不过,本着不想破坏cartographer包的完整性的想法,没有想对protobuf降级处理。我现在只是编译一些gazebo的包就开始出错,网上好多在遍历caffe和rcnn等东西的时候也报的同样的错误,也找了好多方法实在不行了,对protobuf重装吧

这里写图片描述

这个是cartographer安装的官方教程

https://google-cartographer.readthedocs.io/en/latest/

VERSION="v3.4.1"

# Build and install proto3.
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout tags/${VERSION}
mkdir build
cd build
cmake -G Ninja \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -Dprotobuf_BUILD_TESTS=OFF \
  ../cmake
ninja
sudo ninja install

这个是cartographer_ros的官方安装文档

https://google-cartographer-ros.readthedocs.io/en/latest/

src/cartographer/scripts/install_proto3.sh

当时更新protobuf版本就是按着下边的这个教程来的,

下边正式开始重装教程

1.github下载源码

https://github.com/google/protobuf/releases

这个可以选择不同版本的protobuf下载,我需要退回2.6.1版本的protobuf,下载好之后解压,会得到一个文件夹protobuf-2.6.1其实找到README.md,这个文档就是安装教程。

2.安装

./autogen.sh

执行这个命令,你可能会遇到下边这张图片的情况
这里写图片描述

你可以看一下这个脚本,其中有这么一段

if test ! -e gtest; then
  echo "Google Test not present.  Fetching gtest-1.5.0 from the web..."
  curl http://googletest.googlecode.com/files/gtest-1.5.0.tar.bz2 | tar jx
  mv gtest-1.5.0 gtest
fi

这个网站已经挂掉了,404,在3.4.1版本的protobuf中这个脚本里有这么一段

if test ! -e gmock; then
  echo "Google Mock not present.  Fetching gmock-1.7.0 from the web..."
  curl $curlopts -L -O https://github.com/google/googlemock/archive/release-1.7.0.zip
  unzip -q release-1.7.0.zip
  rm release-1.7.0.zip
  mv googlemock-release-1.7.0 gmock

  curl $curlopts -L -O https://github.com/google/googletest/archive/release-1.7.0.zip
  unzip -q release-1.7.0.zip
  rm release-1.7.0.zip
  mv googletest-release-1.7.0 gmock/gtest
fi

可以看到这个网站已经换到github了,但是我们可以从github下载这个包

https://github.com/google/googletest/tree/release-1.5.0

下载好之后,解压得到googletest-release-1.5.0,把这个文件夹拷贝到protobuf-2.6.1文件夹里边,然后重命名为gtest

然后再执行./autogen.sh这个命令

这里写图片描述

然后你又有可能出现这个错误,这个因为有几个包没装

sudo apt-get install autoconf
sudo apt-get install automake 
sudo apt-get install libtool

确定这几个包装好之后,再次运行./autogen.sh这个命令就正常了,然后会生成一个configure文件,再执行下班的命令,就成了

./configure
make
make check
make install

然后查看一下protobuf的版本

sun@sun  ~  protoc --version
libprotoc 2.6.1

参考文章:

http://blog.csdn.net/u013498583/article/details/74231058

http://blog.csdn.net/10km/article/details/53023527

https://github.com/google/protobuf/tree/v2.6.1

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值