Flatbuffers: grpc/samples/greeter Not building

Created on 9 Dec 2019  Â·  10Comments  Â·  Source: google/flatbuffers

make on flatbuffers/grpc/samples/greeter is throwing below error at multiple places-

error: no type named 'ClientContext' in namespace 'grpc'; did you mean 'grpc_impl::ClientContext'?

* sample error line
In file included from greeter.grpc.fb.cc:6:
./greeter.grpc.fb.h:35:37: error: no type named 'ClientContext' in namespace 'grpc'; did you mean 'grpc_impl::ClientContext'?
virtual ::grpc::Status SayHello(::grpc::ClientContext
context, const flatbuffers::grpc::Message& request, flatbuffers::grpc::Message* response) = 0;

Most helpful comment

I am currently looking at this issue. It's apparently due to out of sync between flatbuffers and grpc. As maheshtuppad@ mentioned, for now flatbuffers can work with grpc 1.15.1 and protobuf 3.6.1.

This PR allows us to run grpc test in Bazel: https://github.com/google/flatbuffers/pull/6040
Start from there, I will bump up the version locally and try to fix the codegen part.

All 10 comments

Hmm, I am guessing something changed in upstream gRPC. Can you submit a PR to fix this?

I am new (Day 0) to Flatbuffers and grpc. I can only do it once i am familiar with these tech.

Im getting the same errors for the cpp greeter example

In file included from /tmp/libgrpc/test_grpc_flatbuf_conan/client_flatbuf.cpp:2:0:
/tmp/libgrpc/test_grpc_flatbuf_conan/cmake-build-debug/greeter.grpc.fb.h:35:45: error: ‘grpc::ClientContext’ has not been declared
virtual ::grpc::Status SayHello(::grpc::ClientContext* context, const flatbuffers::grpc::Message& request, flatbuffers::grpc::Message* response) = 0;

Sadly it is pretty easy for gRPC and FlatBuffers to get out of sync.. this would require either using an older version of gRPC, or updating FlatBuffers codegen to latest gRPC. PRs welcome!

greeter example works with grpc v1.15.1 and proto 3.6.1
on mac, I also changed server to listen to localhost (example has 0.0.0.0 which did not work for me)
.

Same here, flatbuffers 1.12.0 is not compatible with grpc 1.29.1 (the default versions in brew). Any hints?

Can confirm Flatbuffers 1.12.0 is not working with Grpc 1.29.1 (via vcpkg) on Windows. It will be helpful to find out which versions are compatible at this moment.

EDIT: - GRPC version v1.17.1 works with Flatbuffers 1.12.0, however, there is also this issue
To use it with vcpkg you have to check out the commit to that port version -
git checkout 585338f76 -- ports\grpc

EDIT2: Using the grpc version that ships with Flatbuffer - master/grpc compiles on Ubuntu but doesn;t work in x64 VS 2017.

Having the same issue on Linux and gRPC v1.25 and flatbuffers v1.12.0.

The most recent grpc v1.30.1 with flatbuffer v1.12.0, tests fail to build on Linux:

flatbuffers/tests/monster_test.grpc.fb.h:38:42: error: ‘grpc::ClientContext’ has not been declared
virtual ::grpc::Status Store(::grpc::ClientContext* context, const flatbuffers::grpc::Message& request, flatbuffers::grpc::Message* response) = 0;

I am currently looking at this issue. It's apparently due to out of sync between flatbuffers and grpc. As maheshtuppad@ mentioned, for now flatbuffers can work with grpc 1.15.1 and protobuf 3.6.1.

This PR allows us to run grpc test in Bazel: https://github.com/google/flatbuffers/pull/6040
Start from there, I will bump up the version locally and try to fix the codegen part.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NN--- picture NN---  Â·  6Comments

gorakhargosh picture gorakhargosh  Â·  5Comments

tymcauley picture tymcauley  Â·  3Comments

jfuehner picture jfuehner  Â·  8Comments

GStones picture GStones  Â·  9Comments