我有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
所以,我决定从INSTALL笔记中提到的源代码编译它并做了:
$ 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 results in
[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
我无法弄清楚如何安装它。任何帮助将不胜感激。
答案 0 :(得分: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");
更具体地说,请打开文件src/compiler/csharp_generator.cc
并将 GetUflectionClassName 的所有引用替换为 GetReflectionClassName
答案 1 :(得分:1)
向后工作:
for release-0_11:看起来你正试图针对最新的protobuf进行编译。由于我们现在都处于开发状态,偶尔会出现故障 - 但grpc确实跟踪了它在third_party / protobuf中测试过的protobuf的版本。尝试签出并安装该版本。我提交了https://github.com/grpc/grpc/issues/4697来更新最新的protobuf 3.0版本。
对于github的master:你使用的是哪个编译器和操作系统?我最近检查了boringssl集成工作,所以它很新鲜,而且几乎没有经过考验。我想让它经受战斗考验。也就是说,如果你做了一个“make EMBED_OPENSSL = false&#39;那么事情应该适合你。
对于debian包问题:我不确定是怎么回事。如果您能告诉我它是哪个操作系统,我很高兴尝试使用您的操作系统和重新启动虚拟机。