Я пытаюсь собрать двоичные файлы grp c -1.26.0 / examples / cpp / load_balancing, я установил gRP C с
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/grpc -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_ABSL_PROVIDER=package -DgRPC_CARES_PROVIDER=package -DgRPC_PROTOBUF_PROVIDER=package -DgRPC_SSL_PROVIDER=package -DgRPC_ZLIB_PROVIDER=package ../..
и сначала он не устанавливает -DgRPC_ABSL_PROVIDER и предупреждает меня (нужно ли мне это ?? и как мне его установить?)
и во-вторых, когда я запускаю make, я получаю следующую ошибку
# make
g++ -std=c++11 `pkg-config --cflags protobuf grpc` -c -o helloworld.grpc.pb.o helloworld.grpc.pb.cc
In file included from helloworld.grpc.pb.cc:6:0:
helloworld.grpc.pb.h:57:45: error: ‘grpc::ClientContext’ has not been declared
virtual ::grpc::Status SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::helloworld::HelloReply* response) = 0;
^~~~~~~~~~~~~
In file included from helloworld.grpc.pb.cc:6:0:
helloworld.grpc.pb.h:58:115: error: ‘grpc::ClientContext’ has not been declared
rpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>> AsyncSayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) {
^~~~~~~~~~~~~
helloworld.grpc.pb.h:61:122: error: ‘grpc::ClientContext’ has not been declared
ientAsyncResponseReaderInterface< ::helloworld::HelloReply>> PrepareAsyncSayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) {
^~~~~~~~~~~~~
helloworld.grpc.pb.h:68:37: error: ‘grpc::ClientContext’ has not been declared
virtual void SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest* request, ::helloworld::HelloReply* response, std::function<void(::grpc::Status)>) = 0;
^~~~~~~~~~~~~
helloworld.grpc.pb.h:69:37: error: ‘grpc::ClientContext’ has not been declared
virtual void SayHello(::grpc::ClientContext* context, const ::grpc::ByteBuffer* request, ::helloworld::HelloReply* response, std::function<void(::grpc::Status)>) = 0;
^~~~~~~~~~~~~
helloworld.grpc.pb.h:73:109: error: ‘AsyncSayHelloRaw’ declared as a ‘virtual’ field
::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>* AsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) = 0;
^~~~~~~~~~~~~
helloworld.grpc.pb.h:73:84: error: expected ‘;’ at end of member declaration
virtual ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>* AsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) = 0;
^~~~~~~~~~~~~~~~
helloworld.grpc.pb.h:73:122: error: expected ‘)’ before ‘*’ token
ResponseReaderInterface< ::helloworld::HelloReply>* AsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) = 0;
^
helloworld.grpc.pb.h:74:116: error: ‘PrepareAsyncSayHelloRaw’ declared as a ‘virtual’ field
tAsyncResponseReaderInterface< ::helloworld::HelloReply>* PrepareAsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) = 0;
^~~~~~~~~~~~~
helloworld.grpc.pb.h:74:84: error: expected ‘;’ at end of member declaration
virtual ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>* PrepareAsyncSayHelloRaw(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) = 0;
^~~~~~~~~~~~~~~~~~~~~~~
Это просто подсказка об ошибках, которые я получаю ......
Сгенерированный helloworld.grp c .pb.h выглядит следующим образом:
// Generated by the gRPC C++ plugin.
// If you make any local change, they will be lost.
// source: helloworld.proto
// Original file comments:
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef GRPC_helloworld_2eproto__INCLUDED
#define GRPC_helloworld_2eproto__INCLUDED
#include "helloworld.pb.h"
#include <functional>
#include <grpcpp/impl/codegen/async_generic_service.h>
#include <grpcpp/impl/codegen/async_stream.h>
#include <grpcpp/impl/codegen/async_unary_call.h>
#include <grpcpp/impl/codegen/client_callback.h>
#include <grpcpp/impl/codegen/method_handler_impl.h>
#include <grpcpp/impl/codegen/proto_utils.h>
#include <grpcpp/impl/codegen/rpc_method.h>
#include <grpcpp/impl/codegen/server_callback.h>
#include <grpcpp/impl/codegen/service_type.h>
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/impl/codegen/stub_options.h>
#include <grpcpp/impl/codegen/sync_stream.h>
namespace grpc {
class CompletionQueue;
class Channel;
class ServerCompletionQueue;
class ServerContext;
} // namespace grpc
namespace helloworld {
// The greeting service definition.
class Greeter final {
public:
static constexpr char const* service_full_name() {
return "helloworld.Greeter";
}
class StubInterface {
public:
virtual ~StubInterface() {}
// Sends a greeting
virtual ::grpc::Status SayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::helloworld::HelloReply* response) = 0;
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>> AsyncSayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>>(AsyncSayHelloRaw(context, request, cq));
}
std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>> PrepareAsyncSayHello(::grpc::ClientContext* context, const ::helloworld::HelloRequest& request, ::grpc::CompletionQueue* cq) {
return std::unique_ptr< ::grpc::ClientAsyncResponseReaderInterface< ::helloworld::HelloReply>>(PrepareAsyncSayHelloRaw(context, request, cq));
}
Я не уверен как почему пространство имен grp c не содержит всех зависимостей, как заставить их генерироваться в сгенерированном файле? или это то, что я что-то здесь упускаю.
Новичок в сфере gRP C и пытаюсь добиться успеха. Любой ответ будет оценен, спасибо.
Syed