安装protobuf
第一步:app开发定制下载安装包
app开发定制官方下载地址:
1、首先确定自己当前linux版本(当前版本为x86_64)
uname -aLinux 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
- 1
- 2
2、选择相应的版本下载并解压到自己想要的目录,我创建了一个protoc目录解压到这里面
wget https://github.com/protocolbuffers/protobuf/releases/tag/v21.5/protoc-21.5.0-linux-x86_64.zipunzip protoc-21.5.0-linux-x86_64.zip
- 1
- 2
- 3
3、查看官方给出的信息,不过我并么有复制protoc/include/google文件到/usr/local/include
解压protoc压缩包后,可以看到 readme.txt文件
Protocol Buffers - Google's data interchange formatCopyright 2008 Google Inc.https://developers.google.com/protocol-buffers/This package contains a precompiled binary version of the protocol buffercompiler (protoc). This binary is intended for users who want to use ProtocolBuffers in languages other than C++ but do not want to compile protocthemselves. To install, simply place this binary somewhere in your PATH.If you intend to use the included well known types then don't forget tocopy the contents of the 'include' directory somewhere as well, for exampleinto '/usr/local/include/'.Please refer to our official github site for more installation instructions: https://github.com/protocolbuffers/protobuf
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
大致意思是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
- 1
第三步:检查是否成功
protoc --versionlibprotoc 3.21.5
- 1
- 2