如何修复 CMake:The imported target "gRPC::grpc_cpp_plugin" references the file
问题
在尝试构建依赖 gRPC 的 C++ 项目时,你可能会遇到以下错误:
cmake-grpc-cpp-plugin-error.txt
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/grpc/gRPCTargets.cmake:194 (message):
The imported target "gRPC::grpc_cpp_plugin" references the file
"/usr/bin/grpc_cpp_plugin"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/x86_64-linux-gnu/cmake/grpc/gRPCTargets.cmake"
but not all the files it references.
Call Stack (most recent call first):
/usr/lib/x86_64-linux-gnu/cmake/grpc/gRPCConfig.cmake:25 (include)
CMakeLists.txt:37 (find_package)解决方案
你需要安装 protobuf-compiler-grpc 以获取 grpc_cpp_plugin 可执行文件。可以使用以下命令安装:
install-protobuf-compiler-grpc.sh
sudo apt -y install protobuf-compiler-grpcCheck out similar posts by category:
C/C++
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow