找回密码
 立即注册
查看: 369|回复: 5

protobuf 安装

[复制链接]
发表于 2022-1-29 16:50 | 显示全部楼层 |阅读模式
Ubuntu
// 下载 protoBuf:
$ git clone https://github.com/protocolbuffers/protobuf.git
//  安装依赖库
$ sudo apt-get install autoconf  automake  libtool curl make  g++  unzip libffi-dev -y
// 进入目录
$ cd protobuf/
// 自动生成configure配置文件:
$ ./autogen.sh
// 配置环境:
$ ./configure
// 编译源代码(要有耐心!):
$ make
// 安装
$ sudo make install
// 刷新共享库 (很重要的一步啊)
$ sudo ldconfig
// 成功后需要使用命令测试
$ protoc -h centos

# 下载 protoBuf:
git clone https://github.com/protocolbuffers/protobuf.git
yum install -y autoreconf automake  libtool
./autogen.sh
# 配置环境:
./configure
# 编译源代码(要有耐心!):
make
sudo make install
# 刷新共享库 (很重要的一步啊)
sudo ldconfig
# 成功后需要使用命令测试
protoc -h
发表于 2022-1-29 16:54 | 显示全部楼层
ubuntu系统,一开始我用apt install方式不成功,
$ apt-get install protobuf
Reading package lists... Done
Building dependency tree      
Reading state information... Done
E: Unable to locate package protobuf

现在按照源码安装可以成功.

# protoc --version
libprotoc 3.14.0

找个程序测试下.

[棒]
发表于 2022-1-29 17:02 | 显示全部楼层
centos 的安装yum install -y autoreconf 应该是yum install -y autoconf
发表于 2022-1-29 17:09 | 显示全部楼层
centos直接源码安装

wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protobuf-all-3.15.8.tar.gz
tar xvf protobuf-all-3.15.8.tar.gz
cd protobuf-3.15.8
./configure
make
make install
发表于 2022-1-29 17:19 | 显示全部楼层
# 编译源代码(要有耐心!): 是真的慢,,, 2g速度的感觉
 楼主| 发表于 2022-1-29 17:29 | 显示全部楼层
make -j8 几分钟就行
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2025-6-1 16:36 , Processed in 0.347344 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表