通过CMake使用安装在Linux中自定义位置的Protobuf吗?

时间:2019-06-21 16:26:01

标签: linux cmake protocol-buffers

我将所有依赖项与Conan IO打包在一起,用于使用CMake的C ++项目。我下载了Protobuf的源代码并进行了构建。然后,我将它们添加到了柯南。

在构建服务器上,我正在尝试构建CMake项目,但似乎无法正确找到我的Protobuf库。这是我得到的日志:

/home/user/Documents/project/test/build/venv/.conan/data/Protobuf/3.6.1/org/dev/package/80043e232e8ab07f4b25e67652a9490d9ad33d91/bin/protoc: error while loading shared libraries: libprotoc.so.17: cannot open shared object file: No such file or directory
CMake Warning at /home/username/Documents/project/test/build/venv/lib/python3.6/site-packages/cmake/data/share/cmake-3.10/Modules/FindProtobuf.cmake:455 (message):
  Protobuf compiler version doesn't match library version 3.6.1
Call Stack (most recent call first):
  /home/username/Documents/project/test/script/cmake/Env.cmake:139 (include)
  CMakeLists.txt:6 (include)


-- Found Protobuf: /home/username/Documents/project/test/build/venv/.conan/data/Protobuf/3.6.1/org/dev/package/80043e232e8ab07f4b25e67652a9490d9ad33d91/lib/libprotobuf.so;-lpthread (found version "3.6.1") 
/home/username/Documents/project/test/build/venv/.conan/data/Protobuf/3.6.1/org/dev/package/80043e232e8ab07f4b25e67652a9490d9ad33d91/bin/protoc: error while loading shared libraries: libprotoc.so.17: cannot open shared object file: No such file or directory
CMake Warning at /home/username/Documents/project/test/build/venv/lib/python3.6/site-packages/cmake/data/share/cmake-3.10/Modules/FindProtobuf.cmake:455 (message):
  Protobuf compiler version doesn't match library version 3.6.1
Call Stack (most recent call first):
  /home/username/Documents/project/test/src/shared/bysp/CMakeLists.txt:9 (find_package)


-- Found Protobuf: /home/username/Documents/project/test/build/venv/.conan/data/Protobuf/3.6.1/org/dev/package/80043e232e8ab07f4b25e67652a9490d9ad33d91/lib/libprotobuf.so;-lpthread;-lpthread (found version "3.6.1") 

我很难理解问题所在。它说找不到libprotoc.so.17,但是该文件存在于我的柯南包中/lib下。然后说确实找到了我的图书馆。我不明白为什么它会向我发出警告,然后说它找到了图书馆。另外,protobuf未安装在构建服务器上。所有依赖项都是通过柯南下载的预编译二进制文件。我正在使用FindProtobuf查找protobuf。我应该再使用其他东西吗?

0 个答案:

没有答案