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
但是這樣隻是解決以下燃眉之急,還有很多依賴可能無法找到,因為這隻是治标不治本。