我们用系统自动安装的 protobuf 一般都是 2 版本的,现在一些工具则对版本有要求,下面就是升级 protobuf 的具体操作:
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig
上面步骤都运行成功了,这时通过下面的命令查看当前版本信息:
protoc --version
以我的电脑为例,会输出:
libprotoc 3.7.1