【发布时间】:2021-02-25 03:54:44
【问题描述】:
你应该怎么做才能修复这个 grpc 编译错误?
#10 629.8 [ 64%] Building CXX object CMakeFiles/grpc++_reflection.dir/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.cc.o
#10 629.8 /usr/bin/x86_64-linux-gnu-g++ -DCARES_STATICLIB -D__CLANG_SUPPORT_DYN_ANNOTATION__ -I/home/src/third_party/zlib -I/home/src/include -I/home/src -I/home/src/third_party/address_sorting/include -I/home/src/third_party/boringssl-with-bazel/src/include -I/home/src/src/core/ext/upb-generated -I/home/i
nfinera/src/third_party/upb -I/home/src/build/x86_64/third_party/zlib -I/home/src/build/x86_64/gens -I/home/src/third_party/protobuf/src -I/home/src/build/x86_64/third_party/cares/cares -I/home/src/third_party/cares/cares -I/home/src/third_party/abseil-cpp -fPIC -std=c++11 -o CMakeFiles/grpc++_reflection
.dir/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.cc.o -c /home/src/build/x86_64/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.cc
#10 629.8 In file included from /home/src/build/x86_64/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.cc:4:
#10 629.8 /home/src/build/x86_64/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#10 629.8 #error This file was generated by a newer version of protoc which is
#10 629.8 ^~~~~
#10 629.8 /home/src/build/x86_64/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#10 629.8 #error incompatible with your Protocol Buffer headers. Please update
#10 629.8 ^~~~~
#10 629.8 /home/src/build/x86_64/gens/src/proto/grpc/reflection/v1alpha/reflection.pb.h:14:2: error: #error your headers.
#10 629.8 #error your headers.
#10 629.8 ^~~~~
时间戳前缀是'因为这是在 docker build 中运行的。
我真的不明白编译指示错误试图告诉我什么。
此文件由较新版本的 protoc 生成
好的。
这与您的协议缓冲区标头不兼容。
这太糟糕了。
请更新您的标题。
嗯...不是我刚刚运行cmake 和make 来构建您的项目的安排吗? 我需要对 grpc 的头文件做什么才能“更新”它们?
我如何构建(转述自 Dockerfile):
mkdir -p /home/src && cd /home/src
git clone --branch v1.30.0 https://github.com/grpc/grpc.git ./
git submodule update --init --recursive
mkdir -p /home/src/build/x86_64 && cd /home/src/build/x86_64
cmake ../..
make
【问题讨论】:
标签: c++ cmake compiler-errors grpc