linux 3.11 源码,linux(centos8.1)下安装protobuf3.11.4

最近项目需要使用google 的protocol buffers,就看了下protobuf相关内容,发现网上中文资料大多停留在protobuf2阶段,经查阅protobuf已经更新到3.11.4版本了,并且3系列比2优化的内容更多,使用也更方便。下面记录下从下载源码,编译protobuf库,到测试使用。

1.安装protobuf3.11.4

1.1 解决编译protobuf库文件工具

如果你已经成功在centos下安装了Qt,并可以正常执行编译运行程序,此步骤不需要。

yum -y install autoconf automake libtool curl make g++ unzip

1.2 下载源码并安装

git clone https://github.com/protocolbuffers/protobuf.git

cd protobuf

git submodule update --init --recursive

./autogen.sh

./configure

make

make check

make install # root

ldconfig # refresh shared library cache.

安装库中出现的问题:

我自己第一次编译protobuf源码的时候,没有clone子模块,

即recursive,在执行make check的时候报错了,如下图:

6fa13e7f0bfe5c35db6496f11a19b8e9.png

在报错的情况下,依然执行了make install, 库安装成功了。

but but 后来在看官方文档的时候,发现了这样一句话:If “make check” fails, you can still install, but it is likely that some features of this library will not work correctly on your system. Proceed at your own risk.

文档也没说有啥风险,毕竟开始学,也不清楚啥情况,于是就再编译安装一次吧。

后续又在已经make的源码下,执行clone子模块,继续报错,于是就又重新clone了protobuf源码,按照上述步骤执行,就没有报错了。

注意安装后库的路径:/usr/local/lib下,后面用得着。

4a22c69e37e8049d8f95abb0157e961c.png

成功安装protobuf3.11.4

69fb44e24069389704dbb3f249bbdae7.png

linux(centos8.1)下使用qt5.12.7 no-gui测试protobuf3.11.4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值