以下是安装语句:
cd grpc_folder
git submodule update --init
cmake ..
make -j 4
sudo make install
然而编写依赖gRPC
的程序,发现无法调用gRPC
的CMake
文件,错误提示如下所示:
include could not find load file:
/usr/local/lib/cmake/grpc/gRPCTargets.cmake
在gRPC
的issue
列表中,寻找到解决方案(CMake
安装时,如果第三方依赖在未指明的情况下,默认均通过源码安装,如果无法通过源码安装,则无法生成gRPCTargets.cmake文件):
因此需要指定第三方依赖是通过源码安装,还是已经通过包管理器安装完毕.
因为已经安装了zlib
,protobuf
以及cares
,因此修改cmake ..
为:
cmake -DgRPC_INSTALL=ON -DgRPC_ZLIB_PROVIDER=package -DgRPC