找不到 Protobuf(缺少:Protobuf_PROTOC_EXECUTABLE)

Che*_*eck 8 c c++ cmake protocol-buffers spack

当我在项目的构建目录中执行 cmake 时,出现此错误。最初我得到了一个

未找到 protobuf-config.cmake

错误。所以我给了一个protobuf-config.cmake文件的路径给Protobuf_DIR。后来它开始显示这个新错误:

/opt/cmake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake 处的 CMake 错误:137(消息):找不到 Protobuf(丢失:Protobuf_PROTOC_EXECUTABLE)

(找到合适的版本“3.6.1”,最低要求是“3.0.0”)

我还附上了错误日志文件:https : //drive.google.com/open?id=1y7BZ6lDBtxvla7r-o188xM_FjwLqwhCx

我在 Ubuntu-18 上使用 cmake 版本:3.13 和 protobuf 版本:3.6.1

JL2*_*210 12

您可能没有安装 Protobuf 编译器和开发文件。要解决此问题,请运行以下命令:

sudo apt-get install protobuf-compiler libprotobuf-dev
Run Code Online (Sandbox Code Playgroud)

或者,如果您手动构建 Protobuf,则无法使用构建类型构建它,RelWithDebInfo因为这会导致库和 CMake 出现问题。