简体   繁体   中英

How to fix grpc compilation error for protoc mismatch?

What are you supposed to do to fix this grpc compilation error?

#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   ^~~~~

The timestamp prefixes are 'cuz this is running in a docker build.

I don't really understand what the pragma error is trying to tell me.

This file was generated by a newer version of protoc

Ok.

which is incompatible with your Protocol Buffer headers.

That sucks.

Please update your headers.

Umm...isn't the arrangement that I just run cmake and make to build your project? What exactly do I need to do to grpc's header files to "update" them?

How I build (paraphrased from a 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

Just run make with the grpc project root Makefile .

https://chromium.googlesource.com/external/github.com/grpc/grpc/+/v1.14.0/BUILDING.md

Notably, among the combinations of build systems and OSes, the combination of cmake and Unix/Linux is not listed.

Not an answer for how to fix the CMake-based build, which is what I'd have liked ideally, but maybe sometimes just take the damn path of least resistance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM