Ubuntu18安装protobuf

转载自1、linux下安装google protobuf(详细)_xiexievv的专栏-CSDN博客_linux安装protobuf说明: protobuf已经全面迁移到github,地址:https://github.com/google/protobuf 直接下载2.6.1版本:https://github.com/google/protobuf/archive/v2.6.1.zip我转linux不久所以对linux的各种系统路径不是特别熟悉,网上看了几个教程都没有提到 添加 LIBRARY_PATH路径,导致自...https://blog.csdn.net/xiexievv/article/details/47396725

2、linux安装protoc - 牛奔 - 博客园


 

根据以上两个博主的方法再结合自己实际安装的遇到的问题重新整合出来此版本。

protobuf可以直接在GitHub上面下载,地址为:GitHub - protocolbuffers/protobuf: Protocol Buffers - Google's data interchange format

可以在上面选择自己需要的版本,我当前需要安装的版本是3.1.x的,我是直接在上面下载的zip压缩包,也可以使用克隆方法获取(我通过克隆的方法获取不了代码,所以直接下载的压缩包)。

在下载目录下使用命令解压文件:

$ unzip protobuf-3.1.x.zip

可以将解压的文件移到其他位置(看自己需求,我是在下载目录直接解压安装的),然后进入到解压的目录下:

$ cd protobuf-3.1.x

打开当前目录下README.md文件

 在文件中找到这段有用的文字,如果需要安装二进制文件,则查阅src目录下中README.md文件,随后再打开此文件,里面详细介绍了安装protobuf的流程,将src/README.md中的安装流程附上,在protobuf-3.1.x目录下执行下列命令即可:

To build protobuf from source, the following tools are needed:

  * autoconf
  * automake
  * libtool
  * curl (used to download gmock)
  * make
  * g++
  * unzip

On Ubuntu, you can install them with:

    $ sudo apt-get install autoconf automake libtool curl make g++ unzip

On other platforms, please use the corresponding package managing tool to
install them before proceeding.

If you get the source from github, you need to generate the configure script
first:

    $ ./autogen.sh

This will download gmock source (which is used for C++ Protocol Buffer
unit-tests) to the current directory and run automake, autoconf, etc.
to generate the configure script and various template makefiles.

You can skip this step if you are using a release package (which already
contains gmock and the configure script).

To build and install the C++ Protocol Buffer runtime and the Protocol
Buffer compiler (protoc) execute the following:

    $ ./configure
    $ make
    $ make check
    $ sudo make install
    $ sudo ldconfig # refresh shared library cache
.

If "make check" fails, you can still install, but it is likely that
some features of this library will not work correctly on your system.
Proceed at your own risk.

For advanced usage information on configure and make, please refer to the
autoconf documentation:

  http://www.gnu.org/software/autoconf/manual/autoconf.html#Running-configure-Scripts

按照上述安装完成后,执行protoc --version,会出现当前libporoto的版本信息:

$ protoc --version
libprotoc 3.1.0

以上,安装完毕。

如果需要更新版本,直接将新版本下载按照上述流程即可,新版本会覆盖旧版本。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值