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.04k stars 3.92k forks source link

protobuf 3.7.1 编译最新brpc报错 #2578

Open missximon opened 3 months ago

missximon commented 3 months ago
[root@937d9313ad58 buildTest]# make
Consolidate compiler generated dependencies of target PROTO_LIB
[ 11%] Built target PROTO_LIB
Consolidate compiler generated dependencies of target BUTIL_LIB
[ 44%] Built target BUTIL_LIB
Consolidate compiler generated dependencies of target SOURCES_LIB
[ 94%] Built target SOURCES_LIB
[ 94%] Built target brpc-static
Consolidate compiler generated dependencies of target protoc-gen-mcpack
[ 94%] Linking CXX executable ../output/bin/protoc-gen-mcpack
CMakeFiles/protoc-gen-mcpack.dir/mcpack2pb/generator.cpp.o: In function `google::protobuf::internal::StringTypeTraits::Get(int, google::protobuf::internal::ExtensionSet const&, std::string const&)':
/usr/local/include/google/protobuf/extension_set.h:1056: undefined reference to `google::protobuf::internal::ExtensionSet::GetString(int, std::string const&) const'
CMakeFiles/protoc-gen-mcpack.dir/mcpack2pb/generator.cpp.o: In function `google::protobuf::io::Printer::PrintInternal(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >*, char const*)':
/usr/local/include/google/protobuf/io/printer.h:300: undefined reference to `google::protobuf::io::Printer::Print(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, char const*)'
/usr/local/include/google/protobuf/io/printer.h:300: undefined reference to `google::protobuf::io::Printer::Print(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, char const*)'
/usr/local/include/google/protobuf/io/printer.h:300: undefined reference to `google::protobuf::io::Printer::Print(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, char const*)'
/usr/local/include/google/protobuf/io/printer.h:300: undefined reference to `google::protobuf::io::Printer::Print(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, char const*)'
/usr/local/include/google/protobuf/io/printer.h:300: undefined reference to `google::protobuf::io::Printer::Print(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, char const*)'
CMakeFiles/protoc-gen-mcpack.dir/mcpack2pb/generator.cpp.o:/usr/local/include/google/protobuf/io/printer.h:300: more undefined references to `google::protobuf::io::Printer::Print(std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, char const*)' follow
CMakeFiles/protoc-gen-mcpack.dir/mcpack2pb/generator.cpp.o:(.data.rel.ro._ZTVN9mcpack2pb16McpackToProtobufE[_ZTVN9mcpack2pb16McpackToProtobufE]+0x28): undefined reference to `google::protobuf::compiler::CodeGenerator::GenerateAll(std::vector<google::protobuf::FileDescriptor const*, std::allocator<google::protobuf::FileDescriptor const*> > const&, std::string const&, google::protobuf::compiler::GeneratorContext*, std::string*) const'
collect2: error: ld returned 1 exit status
make[2]: *** [output/bin/protoc-gen-mcpack] Error 1
make[1]: *** [src/CMakeFiles/protoc-gen-mcpack.dir/all] Error 2
make: *** [all] Error 2

有知道解决办法的吗...使用pb2.5直接报错:

[root@b8c6e7132fc1 build]# make
[  0%] Generating brpc/grpc_health_check.pb.h, brpc/grpc_health_check.pb.cc
brpc/grpc_health_check.proto:38:51: Expected ")".
make[2]: *** [brpc/grpc_health_check.pb.h] Error 1
make[1]: *** [CMakeFiles/PROTO_LIB.dir/all] Error 2
make: *** [all] Error 2

发现需要升级到3+,就升级到了3.7.1,然后还是报错

missximon commented 3 months ago

brpc version: commit id d4695c90092c2574d27e9f6eaa9dc9a86137be40

wasphin commented 3 months ago

像是编译的 protobuf 和 brpc 的 _GLIBCXX_USE_CXX11_ABI 不一样导致的,可以统一下配置