Ubuntu安装Protobuf,指定版本
参考:https://github.com/protocolbuffers/protobuf#readme
https://github.com/protocolbuffers/protobuf/blob/v3.20.3/src/README.md
其实官网的readme给的步骤很详细。
1.安装相关依赖
sudo apt-get install autoconf automake libtool curl make g++ unzip
1.克隆仓库
git clone https://github.com/protocolbuffers/protobuf.git# 可以使用https://ghproxy.com/作为代理,会快很多,如下:git clone https://ghproxy.com/https://github.com/protocolbuffers/protobuf.git
2.切换分支
# 切换分支,这是我的需求,根据你自己的需求进行更改
git checkout v3.20.3# 检查分支状态git status
3.拉取子模块
cd protobufgit submodule update --init --recursive./autogen.sh
4.开编
./configure# 可以安装到指定文件夹
./configure --prefix=/usrmake -j$(nproc)make checksudo make installsudo ldconfig
其实就是官方文档的readme,多看看,英文看习惯了就好了