linux protobuf 安装教程

protobuf 是做什么的?

专业的解答:

Protocol Buffers 是一种轻便高效的结构化数据存储格式,可用于结构化数据串行化,很适合做数据存储或 RPC 数据交换格式。它可用于通讯协议、数据存储等领域的语言无关、平台无关、可扩展的序列化结构数据格式。简单的说就是干和xml一样的事,把某种数据结构的信息,以某种格式保存起来。主要用于数据存储、传输协议格式等场合

protobuf 的优缺点

protobuf 如何安装?

下载安装包

下载地址

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

复制代码

uname-aLinuxlocalhost.localdomain3.10.0-1127.el7.x86_64#1SMP Tue Mar3123:36:51UTC2020x86_64x86_64x86_64GNU/Linux

2、选择相应的版本下载并解压到当前目录

复制代码

wgethttps://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/protoc-3.14.0-linux-x86_64.zipunzipprotoc-3.14.0-linux-x86_64.zip

3、安装 protoc

解压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 touseProtocolBuffersinlanguages otherthanC++ butdonotwanttocompile protocthemselves.Toinstall, simply place thisbinarysomewhereinyour PATH.Ifyou intendtousethe included well known typesthendon'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

大致意思是安装protoc,只需将bin目录下的二进制文件放在某个位置就行,如果你打算用其中的包含的其他类型,同时需要将include目录的内容也复制到某个地方,例如输入/usr/local/include/

我们把protoc放在/usr/local/bin可执行程序目录中,这样全局都可以访问到,同时把include目录的内容也复制到/usr/local/include/中

复制代码

# 移动安装proto (cd到解压目录bin中后执行)mv proto /usr/local/bin# 把`include`目录的内容复制(cd到解压目录include中后执行)cp google /usr/local/include

复制代码

protoc--versionlibprotoc3.14.0

你可能感兴趣的:(linux protobuf 安装教程)