brpc icon indicating copy to clipboard operation
brpc copied to clipboard

brpc 使用arena分配pb内存编译错误

Open helloqingbing opened this issue 2 years ago • 1 comments

Describe the bug (描述bug) incubator-brpc-1.1.0.tar.gz / protobuf-3.19.2.tar.gz / thrift-0.16.0.tar.gz

To Reproduce (复现方法) 构建brpc /opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: ../deps/incubator-brpc/lib/libbrpc.a(list_service.o): in function google::protobuf::internal::GenericTypeHandler<google::protobuf::ServiceDescriptorProto>::New(google::protobuf::Arena*)': /usr/local/include/google/protobuf/repeated_ptr_field.h:413: undefined reference to google::protobuf::ServiceDescriptorProto* google::protobuf::Arena::CreateMaybeMessagegoogle::protobuf::ServiceDescriptorProto(google::protobuf::Arena*)' /opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: ../deps/incubator-brpc/lib/libbrpc.a(builtin_service.pb.o): in function google::protobuf::internal::GenericTypeHandler<google::protobuf::ServiceDescriptorProto>::New(google::protobuf::Arena*)': /usr/local/include/google/protobuf/repeated_ptr_field.h:413: undefined reference to google::protobuf::ServiceDescriptorProto* google::protobuf::Arena::CreateMaybeMessagegoogle::protobuf::ServiceDescriptorProto(google::protobuf::Arena*)' /opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/ld: /usr/local/include/google/protobuf/repeated_ptr_field.h:413: undefined reference to `google::protobuf::ServiceDescriptorProto* google::protobuf::Arena::CreateMaybeMessagegoogle::protobuf::ServiceDescriptorProto(google::protobuf::Arena*)' collect2: error: ld returned 1 exit status

Expected behavior (期望行为) /usr/local/include/google/protobuf/arena.h 这个文件里面是有CreateMaybeMessage 的

Versions (各种版本) OS: LInux 5.4.42-200.el7.x86_64 Compiler: g++11 brpc: protobuf:

Additional context/screenshots (更多上下文/截图)

helloqingbing avatar Jul 21 '22 07:07 helloqingbing

可能是你机器上有多个protobuf版本,头文件引用的是一个版本,链接时用的是另一个版本

wwbmmm avatar Jul 28 '22 03:07 wwbmmm