В скомпилированном коде grpc сервиса отсутствуют некоторые методы
Я скомпилил grpc код с помощью cmake
cmake_minimum_required(VERSION 3.17)
set(CMAKE_CXX_STANDARD 20)
project(GeoIndex)
find_package(Boost 1.74.0 REQUIRED thread )
find_package(LibCDS CONFIG REQUIRED PATHS /home/anton/vcpkg/packages/libcds_x64-linux/share/libcds)
include_directories(${Boost_INCLUDE_DIRS})
find_package(Threads REQUIRED)
set(protobuf_MODULE_COMPATIBLE TRUE)
find_package(Protobuf CONFIG REQUIRED)
message(STATUS "Using protobuf ${Protobuf_VERSION}")
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
set(_REFLECTION gRPC::grpc++_reflection)
if(CMAKE_CROSSCOMPILING)
find_program(_PROTOBUF_PROTOC protoc)
else()
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
endif()
find_package(gRPC CONFIG REQUIRED)
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(_GRPC_GRPCPP gRPC::grpc++)
if(CMAKE_CROSSCOMPILING)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
else()
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
endif()
get_filename_component(proto_file "../Description_of_external_interfaces/GeoIndex.proto" ABSOLUTE)
get_filename_component(proto_file_path "${proto_file}" PATH)
set(proto_src "${CMAKE_CURRENT_BINARY_DIR}/GeoIndex.pb.cc")
set(proto_h "${CMAKE_CURRENT_BINARY_DIR}/GeoIndex.pb.h")
set(grpc_src "${CMAKE_CURRENT_BINARY_DIR}/GeoIndex.grpc.pb.cc")
set(grpc_h "${CMAKE_CURRENT_BINARY_DIR}/GeoIndex.grpc.pb.h")
add_custom_command(
OUTPUT "${proto_src}" "${proto_h}" "${grpc_src}" "${grpc_h}"
COMMAND ${_PROTOBUF_PROTOC}
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
-I "${proto_file_path}"
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
"${proto_file}"
DEPENDS "${proto_file}")
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(../Cone/QuadTree/include)
include_directories(../Cone/web/include)
include_directories(../Cone/CDSHelper/include)
include_directories(include )
file(GLOB C_SOURCES "src/*.cpp")
add_executable(GeoIndex ${proto_src} ${grpc_src} ${C_SOURCES} include/DriverClientConnector.h)
target_link_libraries(GeoIndex Boost::thread LibCDS::cds-s /home/anton/dev/techno_park/geo_index_service/Cone/web/Build/libcone_web.so
/home/anton/dev/techno_park/geo_index_service/Cone/QuadTree/cmake-build-debug/libcone_quadTree.so
${_REFLECTION} ${_GRPC_GRPCPP} ${_PROTOBUF_LIBPROTOBUF})
Но на стороне сервиса отсутствует реализация класса ServerBuilder.
Строчка
grpc::ServerBuilder builder;
вызывает ошибку
Variable has incomplete type 'grpc::ServerBuilder'
Если брать клиента, отсутствует метода CreateChannel(). Причем классы самих сервисов присутствуют. Вот мой .proto файл
syntax = "proto3";
package MailTaxiAPI;
message Coordinate{
double latitude = 1;
double longitude = 2;
}
message LocationData{
string token = 1;
Coordinate coordinate = 2;
bool isDriver = 3;
}
message DriverLocationData{
Coordinate coordinate = 1;
bool busy = 2;
}
enum OrderStatus{
economy = 0;
business = 1;
}
message Driver{
OrderStatus status = 1;
bool children = 2;
bool animals = 3;
}
message DriverInformation{
string token = 1;
Driver driver = 2;
Coordinate coordinate = 3;
}
service OrderService{
rpc GetDrivers(GetDriversRequest) returns (GetDriversResponse){}
rpc RegDriver(RegDriverRequest) returns (RegDriverResponse){}
}
message GetDriversRequest{
Coordinate coordinate = 1;
OrderStatus status = 2;
bool children = 3;
bool animals = 4;
}
message GetDriversResponse{
repeated DriverInformation information = 1;
}
message RegDriverRequest{
Driver driver = 1;
Coordinate coordinate = 2;
string token = 3 ;
}
message RegDriverResponse{
bool success = 1;
}
Почему так происходит?