apache / brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
https://brpc.apache.org
Apache License 2.0
16.56k stars 3.98k forks source link

编译报错,protoc版本问题 #2807

Open FHBOL opened 3 weeks ago

FHBOL commented 3 weeks ago

Describe the bug (描述bug) 编译报错,protoc版本不合适 按照文档,make后出现,可能是protoc版本的问题,但是文档中没有指明合适的版本,我的protoc版本应该是5.28.3,自己在另一台ubuntu22上也是出现同样的问题,另一台Ubuntu的protoc版本为3.20.3,我在两台电脑都出现了同样的问题,那感觉其他人在首次编译brpc大概率也会出现同样的问题,希望在文档中补全相关的解决方案 To Reproduce (复现方法) /Users/fang/brpc/idl_options.pb.h:12:2: error: This file was generated by a newer version of protoc which is

error This file was generated by a newer version of protoc which is

^ /Users/fang/brpc/idl_options.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update

error incompatible with your Protocol Buffer headers. Please update

^ /Users/fang/brpc/idl_options.pb.h:14:2: error: your headers.

error your headers.

^ /Users/fang/brpc/idl_options.pb.h:36:1: error: unknown type name 'PROTOBUF_NAMESPACE_OPEN' PROTOBUF_NAMESPACE_OPEN ^ /Users/fang/brpc/idl_options.pb.h:37:1: error: expected unqualified-id namespace internal { ^ /Users/fang/brpc/idl_options.pb.h:40:1: error: unknown type name 'PROTOBUF_NAMESPACE_CLOSE' PROTOBUF_NAMESPACE_CLOSE ^ /Users/fang/brpc/idl_options.pb.h:46:16: error: no member named 'PROTOBUF_NAMESPACE_ID' in the global namespace extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_idl_5foptions_2eproto; ~~^ /Users/fang/brpc/idl_options.pb.h:47:1: error: unknown type name 'PROTOBUF_NAMESPACE_OPEN' PROTOBUF_NAMESPACE_OPEN ^ /Users/fang/brpc/idl_options.pb.h:48:25: error: expected ';' after top level declarator PROTOBUF_NAMESPACE_CLOSE

Expected behavior (期望行为)

Versions (各种版本) OS:mac sequoia 15.0.1 Compiler: clang version 14.0.3 brpc: Commit e1bf467 protobuf:5.28.3

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

wasphin commented 2 weeks ago

看着是使用了不同版本的 protobuf 进行混合编译,建议清理下生成的 pb 文件全新编译下试试