google protobuf在ubuntu上安装使用步骤
来源:互联网 发布:电信网络诈骗手段 编辑:程序博客网 时间:2024/05/21 07:59
1、从github下载protobuff源码。
https://github.com/google/protobuf
2、安装依赖项:
* autoconf
* automake
* libtool
* curl (used to download gmock)
执行下面即可:
$ sudo apt-get install autoconf automake libtool curl
3、产生安装脚本:
$ ./autogen.sh ##注意:此处需要翻墙才能成功
4、安装:
$ cd protobuf-master
$ ./configure --prefix=/usr/local/protobuf ##这里是定义安装的位置
$ make
$ make check
$ sudo make install
$ sudo ldconfig # refresh shared library cache.
$ make check
$ sudo make install
$ sudo ldconfig # refresh shared library cache.
5、配置动态链接库路径
sudo vim /etc/ld.so.conf
插入:
/usr/local/protobuf/lib变量。
sudo vim /etc/ld.so.conf
插入:
/usr/local/protobuf/lib变量。
sudo vim /etc/profile
添加
export PATH=$PATH:/usr/local/protobuf/bin/
export PKG_CONFIG_PATH=/usr/local/protobuf/lib/pkgconfig/
保存执行
source /etc/profile
6、如果要交叉编译的话,比如我要编译hi3518上面用的库时,./configure的时候这样设置
./configure --build=i686-pc-linux --host=arm-hisiv100nptl-linux --with-protoc=protoc --disable-shared --prefix=/home/huang/Desktop/thridparty/protobuf/2.5.0/forHaisi
然后make&&make install 就可以了
写消息文件:msg.proto
package lm; message helloworld { required int32 id = 1; // ID required string str = 2; // str optional int32 opt = 3; //optional field }
将消息文件msg.proto映射成cpp文件
protoc -I=. --cpp_out=. msg.proto
可以看到生成了
msg.pb.h 和msg.pb.cc
----------------------------------结束------------------------------------------
0 0
- google protobuf在ubuntu上安装使用步骤
- Ubuntu 15.04 安装google protobuf步骤
- Ubuntu 安装Protobuf-php步骤
- Ubuntu上安装protobuf 和protobuf-c
- google protobuf 在Linux下安装与使用
- Protobuf 在Ubuntu 14.04上的编译与使用
- 在Ubuntu上安装protractor步骤
- 在ubuntu上安装google输入法
- [protobuf] 如何在Windows环境下的VS中安装使用Google Protobuf完成SOCKET通信
- mac 上protobuf-2.6.0安装步骤
- ICE3.4.2/3.3.1 POCO1.4.2 google-protobuf 在 arm-linux上安装
- 找出ubuntu上所有安装的protobuf
- 在UnrealEngine4中使用Google Protobuf
- google protobuf 在Linux下使用
- Google protobuf的安装及使用
- Google protobuf的安装及使用
- Google的Protobuf安装及使用笔记
- 【JAVA】google protobuf 3.0 安装使用
- android adb技巧总结
- 算法-分治策略
- Java学习笔记struts2篇--通配符
- 友盟5.0分享 总结
- 排序算法系列:快速排序算法
- google protobuf在ubuntu上安装使用步骤
- consul简介
- 使用wireshark对TLS加密的数据进行实时的解密
- 记录访客的(ip,浏览器,ip归属地,操作系统代码)并记录在文件中
- 4231421
- centos 开启httpd service 出现ServerName error
- JAVA_JCF(Java Collection Framework)学习笔记(二)
- CT 来值班,让您安心过新年!
- Android API Guides翻译与学习——Application Fundamentals