【发布时间】:2020-01-04 00:18:11
【问题描述】:
我正在尝试使用 CMake 构建 gRPC (cpp),但遇到了错误。根据gRPC cpp page 上的说明,我能够使用make 成功构建gRPC。不推荐使用 make,但 CMake 不适合我。
按照下载、克隆等说明进行操作后,我转到“使用 CMake 构建”,上面写着 Linux/Unix,请执行以下操作:
$ mkdir -p cmake/build
$ cd cmake/build
$ cmake ../..
$ make
对我来说,它在第 3 行 (cmake) 失败。以下是输出:
$ cmake ../..
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:138 (include):
include could not find load file:
cmake/zlib.cmake
< repeats above error for the following .cmake files: cares, protobuf, ssl, gflags, benchmark, address_sorting and nanopb>
这些文件 (cmake/<package name>.cmake) 不存在于我系统上的 cmake/ 目录中。我不确定 CMakeLists.txt 文件中的什么内容会导致它们出现在那里。
在研究这个问题时,我针对上面列出的每个失败尝试了 cmake 选项的各种组合,例如 -DBUILD_SHARED_LIBS=ON、-DgRPC_INSTALL=ON 和 -DgRPC<package_name>_PROVIDER=package。我总是遇到同样的错误。最后,我尝试运行run_distrib_test_cmake.sh 脚本。它最终以同样的方式失败了。
有什么想法吗?
【问题讨论】: