首页 > 解决方案 > 在 Ubuntu 3.13.0-163-generic 上构建 GRPC 编译失败

问题描述

我正在使用 make 从源代码在 ubunut 3.13.0-163-generic 中构建 GRPC。我收到以下错误:

[GRPC]    Generating gRPC's protobuf service CC file from src/proto/grpc/channelz/channelz.proto
[libprotobuf FATAL google/protobuf/generated_message_util.cc:794] CHECK failed: (scc->visit_status.load(std::memory_order_relaxed)) == (SCCInfoBase::kRunning):
terminate called after throwing an instance of 'google::protobuf::FatalException'
  what():  CHECK failed: (scc->visit_status.load(std::memory_order_relaxed)) == (SCCInfoBase::kRunning):
--grpc_out: protoc-gen-grpc: Plugin killed by signal 6.
make: *** [/home/iadk/gokul/grcpcpp/grpc/gens/src/proto/grpc/channelz/channelz.grpc.pb.cc] Error 1

为什么 GPRC 无法编译,我该如何解决?

标签: linuxgrpc

解决方案


Ubuntu 3.13.0-163-generic :那就是 Ubuntu 14.04 。默认的 gcc 4.8 使用 GRPC 失败。下载gcc48-c++_4.8.4-2ubuntu14_amd64.deb https://drive.google.com/drive/folders/1xVEATaYAwqvseBzYxKDzJoZ4-Hc_XOJm?usp=sharing ... Ubuntu gcc 4.8 修补了 163 个补丁。gcc48-c++_4.8.4-2ubuntu14:无。

安装编译器

$ sudo gdebi Downloads/gcc48-c++_4.8.4-2ubuntu14_amd64.deb

GRPC

$ sudo apt-get install g++ make autoconf libtool pkg-config libgflags-dev libgtest-dev

$ git clone https://github.com/grpc/grpc.git
$ cd grpc/
$ git submodule update --init

将 Makefile 编辑为 gcc48, g++48 ... 第 50 - 55 行:

DEFAULT_CC = gcc48
DEFAULT_CXX = g++48
else
ifeq ($(HAS_GCC),true)
DEFAULT_CC = gcc48
DEFAULT_CXX = g++48

grpc/:

$ make          // no errors
$ sudo make install

注意git clone https://github.com/grpc/grpc.git很重要。原文中提到的“curl”命令 grpc/BUILDING.md现在可以提供不好的结果。


推荐阅读