ubuntu20.04安装protobuf3.5.0

下载protobuf3.5.0

(1)下载安装包到本地

https://codeload.github.com/google/protobuf/zip/v3.5.0

(2)解压到指定文件夹

cd protobuf-3.5.0
./autogen.sh

提示如下错误:

原因:为安装gmock。

解决:安装gmock-1.7.0

1. 下载解压gmock

https://github.com/paulsapps/gmock-1.7.0
unzip gmock-1.7.0.zip

2. 把gmock解压出来的目录拷贝到protobuf目录下,改名为gmock
     mv gmock-1.7.0 gmock

3. vim aotogen.sh将如下代码注释

if test ! -e gmock; then
  echo "Google Mock not present.  Fetching gmock-1.7.0 from the web..."
  curl -O https://googlemock.googlecode.com/files/gmock-1.7.0.zip
  unzip -q gmock-1.7.0.zip
  rm gmock-1.7.0.zip
  mv gmock-1.7.0 gmock
fi

然后运行如下命令:

./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

参考:https://blog.csdn.net/suyinfan/article/details/74876709

Ubuntu16.04下 protobuf3.4.0 的安装与卸载 - lllittletree - 博客园

protobuf简单介绍和ubuntu 16.04环境下安装_宛十八的专栏-CSDN博客_ubuntu安装protobuf

Ubuntu下安装 protobuf 3_Chris_zhangrx的博客-CSDN博客_ubuntu安装protobuf3

你可能感兴趣的:(p2p,gnu,debian)