Libtorch and gRPC conflicts. How to install?

I faced similar issue in Conflict between libtorch and grpc
If I link only one among libtorch and grpc, it works. However, If I tried to link both at the same time, build failed.

/usr/bin/ld: CMakeFiles/server.dir/ in function `RunServer()': undefined reference to `grpc::ServerBuilder::AddListeningPort(std::string const&, std::shared_ptr<grpc::ServerCredentials>, int*)'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/server.dir/build.make:150: server] Error 1
Environment: Ubuntu 20.04
libtorch: 1.11.0+cpu 
gRPC: 1.50.0 ( And I tried 1.40, 1.38) 

In previous issues which I linked, there was comment, *“Currently the easiest way is to compile libtorch with the protobuf library that grpc uses, or compile grpc with the protobuf library that libtorch uses”.

So I tried to install grpc with the protobuf library that libtorch uses. The process as follows,

# Install torch 1.11.0
unzip && rm

# Install gRPC
git clone -b v1.50.0
cd grpc
git submodule update --init
cd third_party
rm -r protobuf   # remove protobuf and clone protobuf version that libtorch uses
git clone --recurse-submodules -b v3.13.0.1 --depth 1 --shallow-submodules

mkdir -p cmake/build && \
        cd cmake/build && \
        cmake -DgRPC_INSTALL=ON \
              -DgRPC_BUILD_TESTS=OFF \
              -DCMAKE_INSTALL_PREFIX=/usr/local/grpc \
              ../.. && \
        make && \
        make install && \

How can I resolve this problem??? Is it correct way to install protobuf that libtorch uses?