C++ grpc编译错误protobuf 3.2.0(文件是用较旧版本的protoc生成的)Ubuntu 16.04

C++ grpc编译错误protobuf 3.2.0(文件是用较旧版本的protoc生成的)Ubuntu 16.04,c++,ubuntu,makefile,grpc,protoc,C++,Ubuntu,Makefile,Grpc,Protoc,我试着在Ubuntu 16.04.02虚拟机中为cpp编译grpc。由于grpc提供的protobuf版本无法编译(解压后说其中一个zip文件已损坏),因此我自己从源代码处编译了protobuf 3.2.0(据我所知,这应该是正确的版本),效果很好 当我现在运行make来编译grpc时,我遇到了一个很长的错误,这与一些文件是用较旧的protoc版本生成的有关。(我在底部添加了完整的错误消息)。 所以我的问题是:3.2是错误的protobuf版本还是另一个问题?我还尝试根据从grpc的第三方目录中

我试着在Ubuntu 16.04.02虚拟机中为cpp编译grpc。由于grpc提供的protobuf版本无法编译(解压后说其中一个zip文件已损坏),因此我自己从源代码处编译了protobuf 3.2.0(据我所知,这应该是正确的版本),效果很好

当我现在运行make来编译grpc时,我遇到了一个很长的错误,这与一些文件是用较旧的protoc版本生成的有关。(我在底部添加了完整的错误消息)。 所以我的问题是:3.2是错误的protobuf版本还是另一个问题?我还尝试根据从grpc的第三方目录中删除protobuf目录,但没有任何改变

提前谢谢

错误消息:

[CXX]     Compiling src/cpp/ext/proto_server_reflection.cc
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h:51:2: error: #error This file was generated by an older version of protoc which is
 #error This file was generated by an older version of protoc which is
  ^
include/grpc++/ext/reflection.pb.h:52:2: error: #error incompatible with your Protocol Buffer headers. Please
 #error incompatible with your Protocol Buffer headers.  Please
  ^
include/grpc++/ext/reflection.pb.h:53:2: error: #error regenerate this file with a newer version of protoc.
 #error regenerate this file with a newer version of protoc.
  ^
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ServerReflectionRequest::host() const’:
include/grpc++/ext/reflection.pb.h:994:87: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ServerReflectionRequest::file_by_filename() const’:
include/grpc++/ext/reflection.pb.h:1048:118: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ServerReflectionRequest::file_containing_symbol() const’:
include/grpc++/ext/reflection.pb.h:1129:124: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 mbol_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ServerReflectionRequest::all_extension_numbers_of_type() const’:
include/grpc++/ext/reflection.pb.h:1258:131: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ServerReflectionRequest::list_services() const’:
include/grpc++/ext/reflection.pb.h:1339:115: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 ices_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ExtensionRequest::containing_type() const’:
include/grpc++/ext/reflection.pb.h:1423:98: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 type_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ServerReflectionResponse::valid_host() const’:
include/grpc++/ext/reflection.pb.h:1485:93: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 host_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ExtensionNumberResponse::base_type_name() const’:
include/grpc++/ext/reflection.pb.h:1831:97: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ServiceResponse::name() const’:
include/grpc++/ext/reflection.pb.h:1943:87: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 name_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
In file included from include/grpc++/ext/reflection.grpc.pb.h:73:0,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
include/grpc++/ext/reflection.pb.h: In member function ‘const string& grpc::reflection::v1alpha::ErrorResponse::error_message() const’:
include/grpc++/ext/reflection.pb.h:2005:96: error: no matching function for call to ‘google::protobuf::internal::ArenaStringPtr::GetNoArena(const string*) const’
 sage_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
                                                                              ^
In file included from include/grpc++/ext/reflection.pb.h:57:0,
                 from include/grpc++/ext/reflection.grpc.pb.h:73,
                 from ./src/cpp/ext/proto_server_reflection.h:39,
                 from src/cpp/ext/proto_server_reflection.cc:39:
/usr/local/include/google/protobuf/arenastring.h:225:31: note: candidate: const string& google::protobuf::internal::ArenaStringPtr::GetNoArena() const
   inline const ::std::string& GetNoArena() const { return *ptr_; }
                               ^
/usr/local/include/google/protobuf/arenastring.h:225:31: note:   candidate expects 0 arguments, 1 provided
Makefile:2094: recipe for target '/home/snoato/Downloads/grpc/objs/opt/src/cpp/ext/proto_server_reflection.o' failed
make: *** [/home/snoato/Downloads/grpc/objs/opt/src/cpp/ext/proto_server_reflection.o] Error 1

这是添加反射支持时的疏忽。对于gRPC的最新版本,这个问题应该不再存在了,因为我们现在正在生成这些文件


我怀疑你是在试图建立一个有问题的旧版本。请尝试更新:-)

您应该使用较新的protoc版本重新编译
grpc
。编译grpc时出错您必须重新编译
.proto
消息。哦,我明白了,我会尝试的!谢谢但他们为什么要发送旧版本的编译.proto消息呢?不知道,耸耸肩。