Press "Enter" to skip to content

在 Linux 系统通过源码安装 Protobuf

  1. 打开源码下载页

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

  1. 下载源码
wget https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.17.2.tar.gz
tar -zxvf v3.17.2.tar.gz
  1. 编译安装
cd protobuf-3.17.2
./autogen.sh
./configure
make && make install
  1. 查看版本

安装完成,通过 protoc --version 查看版本,可能会报错:protoc: error while loading shared libraries: libprotobuf.so.28: cannot open shared object file: No such file or directory

解决办法:修改环境变量

export LD_LIBRARY_PATH=/usr/local/lib