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 protobuf

git submodule update --init --recursive

./autogen.sh

4.开编

 ./configure

# 可以安装到指定文件夹
./configure --prefix=/usr

 make -j$(nproc)

 make check

 sudo make install

 sudo ldconfig 

  其实就是官方文档的readme,多看看,英文看习惯了就好了

你可能感兴趣的:(ubuntu,linux,运维)