protobuf交叉编译出错 descriptor

it2026-06-10  0

1:使用

$./configure --prefix=/usr/local/protobuf --host=arm-

./configure --host=arm-oe-linux-gnueabi --prefix=/home/ubuntu16/Desktop/work/protobuf/c++_protoc/3.4_build_result/arm/ --with-protoc=protoc  

$ make

$ make check  //有可能出错,不用管

$ make install

 

交叉编译protobuf,出现以下错误:

libtool: warning: library '/home/ubuntu16/Desktop/work/ql-ol-sdk/ql-ol-crosstool/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi/../../armv7a-vfp-neon-oe-linux-gnueabi/usr/lib/libstdc++.la' was moved.   CXXLD    protoc ./.libs/libprotoc.so: error: undefined reference to 'descriptor_table_google_2fprotobuf_2fdescriptor_2eproto' ./.libs/libprotoc.so: error: undefined reference to 'scc_info_FileDescriptorProto_google_2fprotobuf_2fdescriptor_2eproto' collect2: error: ld returned 1 exit status

 

原因3.5.1之后的版本不支持,所以需要使用cmake编译

cmake cmake/ -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=ON

可以参考这个:

https://blog.csdn.net/qq_28386947/article/details/105745808

 

 

最新回复(0)