Hi, I recently tried to use grpc to deploy the model in libtorch (model is just as same as the one in libtorch demo. I had checked grpc installation and it was collectly installed (grpc version: 1.20.0) and when I compiled my project i got an error:
CMakeFiles/resnet_server.dir/resnet_server.cc.o: In function `RunServer()':
resnet_server.cc:(.text+0x11c3): undefined reference to `grpc::ServerBuilder::AddListeningPort(std::string const&, std::shared_ptr<grpc::ServerCredentials>, int*)'
CMakeFiles/resnet_server.dir/__/protos/example.pb.cc.o:(.data.rel.ro._ZTVN7example12DataResponseE[_ZTVN7example12DataResponseE]+0x20): undefined reference to `google::protobuf::Message::GetTypeName() const'
CMakeFiles/resnet_server.dir/__/protos/example.pb.cc.o:(.data.rel.ro._ZTVN7example12DataResponseE[_ZTVN7example12DataResponseE]+0x58): undefined reference to `google::protobuf::Message::InitializationErrorString() const'
CMakeFiles/resnet_server.dir/__/protos/example.pb.cc.o:(.data.rel.ro._ZTVN7example11DataRequestE[_ZTVN7example11DataRequestE]+0x20): undefined reference to `google::protobuf::Message::GetTypeName() const'
CMakeFiles/resnet_server.dir/__/protos/example.pb.cc.o:(.data.rel.ro._ZTVN7example11DataRequestE[_ZTVN7example11DataRequestE]+0x58): undefined reference to `google::protobuf::Message::InitializationErrorString() const'
collect2: error: ld returned 1 exit status
src/CMakeFiles/resnet_server.dir/build.make:156: recipe for target 'src/resnet_server' failed
make[2]: *** [src/resnet_server] Error 1
CMakeFiles/Makefile2:85: recipe for target 'src/CMakeFiles/resnet_server.dir/all' failed
make[1]: *** [src/CMakeFiles/resnet_server.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I realize that libtorch also uses its own libprotobuf.a libprotobuf-lite.a libprotoc.a, which may have conflict with the corresponding protbuf library of grpc.
Environment:ubuntu 18.04
libtorch: latest cpu version
Can someone help me out and fix this? Thanks