1

我有 protobuf 编译器版本 3.0,需要安装 grpc 和 grpc python 插件。按照教程,我添加deb http://http.debian.net/debian jessie-backports main到了我的 sources.list 文件并做了sudo apt-get update并且sudo apt-get install libgrpc-dev返回了

Package libgrpc-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libgrpc-dev' has no installation candidate

所以,我决定按照安装说明中提到的那样从源代码编译它并做了:

 $ git clone https://github.com/grpc/grpc.git
 $ cd grpc
 $ git submodule update --init
 $ make 
 $ [sudo] make install

但是,在制作步骤中,我得到

[MAKE]    Generating cache.mk
make: Circular /home/vagrant/grpc2/grpc/libs/opt/libboringssl.a <- /home/vagrant/grpc2/grpc/libs/opt/libboringssl.a dependency dropped.
[C]       Compiling third_party/boringssl/crypto/bio/connect.c
third_party/boringssl/crypto/bio/connect.c: In function 'split_host_and_port':
third_party/boringssl/crypto/bio/connect.c:127:17: error: declaration of 'close' shadows a global declaration [-Werror=shadow]
cc1: all warnings being treated as errors
make: *** [/home/vagrant/grpc2/grpc/objs/opt/third_party/boringssl/crypto/bio/connect.o] Error 1

在切换到 release-0_11 分支时,运行 make 结果

[HOSTCXX] Compiling src/compiler/csharp_generator.cc
src/compiler/csharp_generator.cc:47:43: error: 'google::protobuf::compiler::csharp::GetUmbrellaClassName' has not been declared
src/compiler/csharp_generator.cc: In function 'void grpc_csharp_generator::{anonymous}::GenerateServiceDescriptorProperty(grpc::protobuf::io::Printer*, const ServiceDescriptor*)':
src/compiler/csharp_generator.cc:237:62: error: 'GetUmbrellaClassName' was not declared in this scope
make: *** [/home/vagrant/grpc2/grpc/objs/opt/src/compiler/csharp_generator.o] Error 1

我不知道如何安装它。任何帮助,将不胜感激。

4

2 回答 2

2

对我来说,在我将文件更改为以下内容后,问题得到了解决:

diff --git a/src/compiler/csharp_generator.cc 

b/src/compiler/csharp_generator.cc
index 7b497df..5a8746d 100644
--- a/src/compiler/csharp_generator.cc
+++ b/src/compiler/csharp_generator.cc
@@ -44,7 +44,7 @@

 using google::protobuf::compiler::csharp::GetFileNamespace;
 using google::protobuf::compiler::csharp::GetClassName;
-using google::protobuf::compiler::csharp::GetUmbrellaClassName;
+using google::protobuf::compiler::csharp::GetReflectionClassName;
 using grpc::protobuf::FileDescriptor;
 using grpc::protobuf::Descriptor;
 using grpc::protobuf::ServiceDescriptor;
@@ -234,7 +234,7 @@ void GenerateServiceDescriptorProperty(Printer* out, const ServiceDescriptor *se
   out->Print("public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor\n");
   out->Print("{\n");
   out->Print("  get { return $umbrella$.Descriptor.Services[$index$]; }\n",
-             "umbrella", GetUmbrellaClassName(service->file()), "index",
+             "umbrella", GetReflectionClassName(service->file()), "index",
              index.str());
   out->Print("}\n");
   out->Print("\n");

更具体地说,请打开文件并将GetUmbrellaClassNamesrc/compiler/csharp_generator.cc的所有引用替换为GetReflectionClassName

于 2016-01-16T02:45:39.517 回答
1

向后工作:

对于 release-0_11:看起来您正在尝试针对最新的 protobuf 进行编译。由于我们现在都处于开发阶段,因此偶尔会出现故障 - 但 grpc 确实会跟踪它在 third_party/protobuf 中对其进行测试的 protobuf 版本。尝试签出并安装该版本。我提交了https://github.com/grpc/grpc/issues/4697以更新到最新的 protobuf 3.0 版本。

来自 github 的大师:您使用的是哪个编译器和操作系统?我最近检查了无聊的集成工作,所以它很新鲜,而且几乎没有经过实战考验。我想让它经过实战考验。也就是说,如果您执行“make EMBED_OPENSSL=false”,那么事情应该会为您解决。

对于 debian 包问题:我不确定发生了什么。如果您可以告诉我它是哪个操作系统,我很高兴尝试使用您的操作系统启动虚拟机并进行复制。

于 2016-01-13T00:30:17.057 回答