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

编译失败 #2761

Closed 707state closed 2 months ago

707state commented 2 months ago

Describe the bug (描述bug) 在Arch Linux上用g++或者clang++都无法通过编译,且报错不同。

g++:

brpc/src/brpc/baidu_master_service.h:91:24: error: cannot declare field ‘brpc::BaiduMasterService::_default_response’ to be of abstract type ‘brpc::SerializedResponse’ 91 | SerializedResponse _default_response;

/brpc/serialized_response.h:29:7: note: because the following virtual functions are pure within ‘brpc::SerializedResponse’: 29 | class SerializedResponse : public ::google::protobuf::Message { ...

clang++

brpc/src/brpc/serialized_request.h:54:32: error: only virtual member functions can be marked 'override' 54 | bool IsInitialized() const override;

brpc/src/brpc/serialized_request.h:70:61: error: only virtual member functions can be marked 'override' 70 | void MergeFrom(const ::google::protobuf::Message& from) override ...

去除override之后为

./src/brpc/serialized_request.h:60:32: error: ‘google::protobuf::Metadata brpc::SerializedRequest::GetMetadata() const’ marked ‘override’, but does not override 60 | ::google::protobuf::Metadata GetMetadata() const override;

To Reproduce (复现方法)

按照 https://brpc.apache.org/docs/getting_started/ 网站上用config_brpc.sh的方法进行编译

Expected behavior (期望行为)

应当正常编译

Versions (各种版本) OS: Arch Linux Compiler: g++/clang++ brpc: master protobuf: 27.3-2 grpc: 1.65.5-1

deadlinefen commented 2 months ago

centos7上遇到了相同情况

chenBright commented 2 months ago

protobuf版本的问题吧,换成protobuf 3试试

Lin807188583 commented 2 months ago

应该是protobuf版本问题。 这类问题我遇到过几次,最近一次是在arch上编译,系统默认安装的pb是v28,出现类似问题,后面源码更新到29还是类似报错,换到3.20.x才顺利编译