需要先安装 git
git clone https://github.com/google/protobuf.git
这个不行把 https 换成 http
下载源码编译安装,需要较长时间,超过10分钟。
sudo apt-get install autoconf automake libtool curl make g++ unzip
git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig # refresh shared library cache.
很有可能,执行过程中会出现以下错误提示:
./autogen.sh: 4: ./autogen.sh: autoreconf: not found
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
protoc --version