ROS编译的时候,遇到proto版本不符合的问题
protoc --version看看你的版本,低于3.0就需要安装
首先需要以下tools:
- autoconf
- automake
- libtool
- make
- g++
- unzip
所以,先安装:
$ sudo apt-get install autoconf automake libtool curl make g++ unzip
然后下载protobuf。
https://github.com/protocolbuffers/protobuf/releases/latest
当然,也可以“git clone”
$ git clone https://github.com/protocolbuffers/protobuf.git
$ cd protobuf
$ git submodule update --init --recursive
#这步出错了,直接git init
$ ./autogen.sh
#这步出错了就是没有安装autoconf
然后编译和安装C++Protocol Buffer runtime 和Protocol Buffer compiler(protoc),执行下面指令
$ ./configure
$ make
$ make check
$ sudo make install
$ sudo ldconfig #refresh shared library cache
如果“make check”失败了,你也可以依旧安装。
然后protoc --version看看你的版本。
如果你之前那个版本没有删除,可以使用如下软命令
sudo mv /usr/bin/protoc /usr/bin/protoc.bk
sudo ln -s /usr/local/bin/protoc /usr/bin/protoc
但是这样只是解决以下燃眉之急,还有很多依赖可能无法找到,因为这只是治标不治本。