在Ubuntu上安装/编译grpc时出错

2024-09-24 02:28:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我有protobuf编译器版本3.0,需要安装grpc和grpc python插件。在教程之后,我将deb http://http.debian.net/debian jessie-backports main添加到我的来源.列表file和did sudo apt-get updatesudo 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

因此,我决定从安装说明中提到的源代码编译它,并执行了以下操作:

^{pr2}$

但是,在make步骤中,我得到

[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

我不知道怎么安装这个。任何帮助都将不胜感激。在


Tags: srchomegrpcmakecompilerispartycrypto
2条回答

向后工作:

对于release-0_11:看起来您正在根据最新的protobuf进行编译。由于我们现在都在开发中,偶尔会有损坏-但是grpc确实跟踪protobuf的版本,它在第三方/protobuf中进行了测试。尝试签出并安装该版本。我归档了https://github.com/grpc/grpc/issues/4697以更新到最新的protobuf3.0版本。在

对于来自github的master:您使用哪个编译器和操作系统?我最近检查了boringssl的集成工作,所以它很新鲜,而且还没有经过战斗测试。我想做个战斗测试。也就是说,如果你做了一个“makeembed_OPENSSL=false”,那么事情应该会为你解决。在

对于debian包的问题:我不确定发生了什么。如果你能告诉我是哪个操作系统的话,我很乐意尝试用你的操作系统来启动一个虚拟机。在

对我来说,在我将文件更改为:

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,并将getumbrallClassName的所有引用替换为GetReflectionClassName

相关问题 更多 >