protobuf最新版本 3.17.3 交叉编译 for arm 带googletest
编译结果
./protoc --version
libprotoc 3.17.3
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
mkdir x64
cd x64
../configure --prefix=$(pwd)/install
make
make install
运行编译好的程序
./install/bin/protoc --version
libprotoc 3.17.3
查看所有库文件
tree install/lib/
install/lib/
├── libprotobuf.a
├── libprotobuf.la
├── libprotobuf-lite.a
├── libprotobuf-lite.la
├── libprotobuf-lite.so -> libprotobuf-lite.so.28.0.3
├── libprotobuf-lite.so.28 -> libprotobuf-lite.so.28.0.3
├── libprotobuf-lite.so.28.0.3
├── libprotobuf.so -> libprotobuf.so.28.0.3
├── libprotobuf.so.28 -> libprotobuf.so.28.0.3
├── libprotobuf.so.28.0.3
├── libprotoc.a
├── libprotoc.la
├── libprotoc.so -> libprotoc.so.28.0.3
├── libprotoc.so.28 -> libprotoc.so.28.0.3
├── libprotoc.so.28.0.3
└── pkgconfig
├── protobuf-lite.pc
└── protobuf.pc
编译arm版本protobuf库
cd ../
mkdir arm
cd arm/
CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ ../configure --prefix=$(pwd)/install --host=arm-linux
make -j8
make install
file ./install/bin/protoc
./install/bin/protoc: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=cea786b94a0b64b866983c8b4541df34e9cc7c1d, with debug_info, not stripped
protobuf/arm$ tree ./install/lib/
./install/lib/
├── libprotobuf.a
├── libprotobuf.la
├── libprotobuf-lite.a
├── libprotobuf-lite.la
├── libprotobuf-lite.so -> libprotobuf-lite.so.28.0.3
├── libprotobuf-lite.so.28 -> libprotobuf-lite.so.28.0.3
├── libprotobuf-lite.so.28.0.3
├── libprotobuf.so -> libprotobuf.so.28.0.3
├── libprotobuf.so.28 -> libprotobuf.so.28.0.3
├── libprotobuf.so.28.0.3
├── libprotoc.a
├── libprotoc.la
├── libprotoc.so -> libprotoc.so.28.0.3
├── libprotoc.so.28 -> libprotoc.so.28.0.3
├── libprotoc.so.28.0.3
└── pkgconfig
├── protobuf-lite.pc
└── protobuf.pc
使用git 直接git clone github的库,不会报googletest 相关的警告,自动下载好了。如果自己在github.com protobuf release哪儿下载的放在,编译时候会报一个没有googletest的警告。好烦。。
configure: WARNING: no configuration information is in third_party/googletest
本文链接地址:https://const.net.cn/280.html