grpc compile error protobuf 3.2.0 (файл был создан с помощью более старой версии protoc) Ubuntu 16.04

Я попытался скомпилировать grpc для cpp на виртуальной машине Ubuntu 16.04.02. Поскольку версия protobuf, поставляемая с grpc, не компилируется (разархивируйте, скажем, один из zip-файлов поврежден), я сам скомпилировал protobuf 3.2.0 (которая должна быть правильной версией, насколько я понимаю) из исходного кода, который работал нормально.

Теперь, когда я запускаю make для компиляции grpc, я получаю длинную ошибку, которая как-то связана с тем фактом, что некоторые файлы были сгенерированы с помощью более старой версии протокола. (Я добавляю полное сообщение об ошибке внизу). Итак, мой вопрос: 3.2 - неправильная версия protobuf или это другая проблема? Я также попытался удалить каталог protobuf из стороннего каталога grpc в соответствии с Нужна помощь в установке c ++ grpc в ubuntu 16.04, но это ничего не изменило.

Заранее спасибо!

Сообщение об ошибке:

[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

person snoato    schedule 11.03.2017    source источник
comment
Тогда вам следует перекомпилировать grpc с более новой версией протокола.   -  person πάντα ῥεῖ    schedule 11.03.2017
comment
Ошибка возникает при компиляции grpc   -  person snoato    schedule 11.03.2017
comment
Вам нужно перекомпилировать .proto сообщения.   -  person πάντα ῥεῖ    schedule 11.03.2017
comment
о, я вижу, я попробую! Благодарность! Но почему они отправляют старые версии скомпилированных сообщений .proto?   -  person snoato    schedule 11.03.2017
comment
Понятия не имею, пожимаем плечами.   -  person πάντα ῥεῖ    schedule 11.03.2017
comment
Хорошо, я попробовал, но ничего не изменилось ... та же ошибка.   -  person snoato    schedule 11.03.2017


Ответы (1)


Это была недоработка с момента добавления поддержки отражения. Этой проблемы больше не должно быть в более поздних версиях gRPC, поскольку теперь мы генерируем эти файлы во время сборки.

Я подозреваю, что вы пытаетесь собрать старую версию, в которой возникла проблема. Пожалуйста, попробуйте обновить :-)

person Nicolas Noble    schedule 14.03.2017