Ubuntu Protobuf 安装(测试有效)

安装流程

  1. 下载软件

    下载自己要安装的版本:https://github.com/protocolbuffers/protobuf
    下载源码编译:
    Ubuntu Protobuf 安装(测试有效)_第1张图片
    系统环境:Ubuntu16(其它版本亦可),Protobuf-3.6.1

  2. 编译源码

    cd protobuf
    
    # 当使用 git clone 下来的工程中带有 submodule 时,
    # submodule 的内容并不会自动下载下来,此时,只需执
    # 行如下命令,就可以下载,避免文件下载不全
    git submodule update --init –recursive
    
    ./autogen.sh
    ./configure
    make
    sudo make install
    sudo ldconfig # refresh shared library cache.
    
     protoc --version(编译完成,查看版本,表示成功安装)
    

    在这里插入图片描述

    编译完成后,相关文件安装位置,具体如下图所示:

    /usr/local/lib:静态库和动态库
    Ubuntu Protobuf 安装(测试有效)_第2张图片

    /usr/local/bin:可执行文件
    在这里插入图片描述

    /usr/local/include/google:头文件
    Ubuntu Protobuf 安装(测试有效)_第3张图片
    google文件夹的内容如下图所示,包含了相关的头文件
    Ubuntu Protobuf 安装(测试有效)_第4张图片

你可能感兴趣的:(C/C++编程,ubuntu,protobuf,安装)