[ubuntu]ubuntu18.04上源码编译protobuf

安装依赖

sudo apt update
sudo apt install libprotobuf-dev protobuf-compiler cmake git  -y

下载源码:

wget https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protobuf-all-3.19.4.tar.gz

 tar -zxvf protobuf-all-3.19.4.tar.gz

你也可以下载其他版本源码或者最新的,比如:

git clone https://github.com/protocolbuffers/protobuf.git

开始编译:

cd protobuf-3.19.4
./autogen.sh
./configure
make -j8
sudo make install
sudo ldconfig    # refresh shared library cache

检查是否安装成功:

protoc --version

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