Ubuntu安装protobuf

Ubuntu安装protobuf

第一步:下载安装包

官方下载地址:https://github.com/protocolbuffers/protobuf/releases

1、首先确定自己当前linux版本(当前版本为x86_64)

uname -a
Linux localhost.localdomain 3.10.0-1127.el7.x86_64 #1 SMP Tue Mar 31 23:36:51 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

2、选择相应的版本下载并解压到自己想要的目录,我创建了一个protoc目录解压到这里面

wget https://github.com/protocolbuffers/protobuf/releases/tag/v21.5/protoc-21.5.0-linux-x86_64.zip

unzip protoc-21.5.0-linux-x86_64.zip

3、查看官方给出的信息,不过我并么有复制protoc/include/google文件到/usr/local/include
解压protoc压缩包后,可以看到 readme.txt文件

Protocol Buffers - Google's data interchange format
Copyright 2008 Google Inc.
https://developers.google.com/protocol-buffers/

This package contains a precompiled binary version of the protocol buffer
compiler (protoc). This binary is intended for users who want to use Protocol
Buffers in languages other than C++ but do not want to compile protoc
themselves. To install, simply place this binary somewhere in your PATH.

If you intend to use the included well known types then don't forget to
copy the contents of the 'include' directory somewhere as well, for example
into '/usr/local/include/'.

Please refer to our official github site for more installation instructions:
  https://github.com/protocolbuffers/protobuf

大致意思是Protocol Buffers - Google 的数据交换格式版权所有 2008 谷歌公司。

https://developers.google.com/protocol-buffers/

此包包含协议缓冲区的预编译二进制版本编译器(协议)。此二进制文件适用于想要使用协议的用户
C++ 以外的其他语言的缓冲区,但不想编译 protoc,他们自己要安装,只需将此二进制文件放在 PATH 中的某个位置。

如果您打算使用包含的众所周知的类型,请不要忘记将“include”目录的内容也复制到某处,例如
进入’/usr/local/include/'。

更多安装说明请参考我们的官方github站点:https://github.com/protocolbuffers/protobuf

第二步:增加Path路径

export PATH=$PATH:/usr/local/bin/protoc/bin

第三步:检查是否成功

protoc --version
libprotoc 3.21.5
  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
安装ProtobufUbuntu上可以按照以下步骤进行: 1. 打开终端,运行以下命令以安装所需的依赖项: ``` sudo apt-get install autoconf automake libtool curl make g++ unzip ``` 2. 克隆Protobuf的源代码,并进入源代码目录: ``` git clone https://github.com/google/protobuf.git cd protobuf ``` 3. 初始化和更新子模块并生成配置文件: ``` git submodule update --init --recursive ./autogen.sh ``` 4. 执行配置命令,生成Makefile: ``` ./configure ``` 5. 使用make命令编译Protobuf: ``` make ``` 6. (可选)运行make check命令进行测试。如果没有克隆子模块,测试可能会失败,但仍然可以继续安装。运行make install命令安装Protobuf: ``` make check sudo make install ``` 以上是在Ubuntu安装Protobuf的一般步骤。根据你的操作系统版本和其他特定条件,可能会有一些差异。如果你遇到任何问题,你可以参考引用提供的链接中详细的问题解决方法。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [ubuntuprotobuf安装使用(详解)](https://blog.csdn.net/m0_46392035/article/details/124697124)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [在 Ubuntu安装 Protobuf 3 的教程详解](https://download.csdn.net/download/weixin_38672800/12842115)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值