linux系统上编译arm版的protobuf库

来源:互联网 发布:大话设计模式java 编辑:程序博客网 时间:2024/06/08 07:18

准备条件:

1.安装gcc编译器和make

2.安装arm-linux或其他arm编译器

可以用arm-linux-gcc -v和gcc -v来检查编译器版本。

 

从官网下载protobuf-2.5.0.tar.gz.

第一步是编译出x86版的库和protoc,

按顺序执行下列命令

tar -zxvf protobuf-2.5.0.tar.gz

cd protobuf-2.5.0

./configure

make

make check

sudo make install

这时已经编译出一个linux版的protobuf库和protoc, 这时需要开始来编arm版,因为下一步需要可以在linux上运行的protoc,所以上面的步骤不能少。

下面开始编译arm版

make clean

./configure --host=arm-linux --with-protoc=protoc

make

如果没有出错,那么arm版的库就编译出来了, 他们的位置是

protobuf-2.5.0/src/.libs/

使用readelf -h libprotobuf-lite.a来查看文件信息,如果对应machin值是ARM,那么就是大功告成了。

 

1 0
原创粉丝点击