【发布时间】:2018-05-10 05:51:18
【问题描述】:
我在 ubuntu 16.04 中使用 tensorflow 1.4 和 qt。问题是当我同时包含 tensorflow(version: 1.4) 和 opencv (version: 3.2.0) 时,protobuf 是冲突的。错误信息如下:
[libprotobuf FATAL external/protobuf_archive/src/google/protobuf/stubs/common.cc:79] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.4.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/build/mir-O8_xaj/mir-0.26.3+16.04.20170605/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.4.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/build/mir-O8_xaj/mir-0.26.3+16.04.20170605/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)
我从某个地方了解到带有gtk-3.x 的opencv 将使用protobuf 2.6.1 导致上述问题,而使用gtk-2.x 安装opencv 将不依赖于protobuf。而部分opencv cmake msg如下,cmake自动使用gtk 3.x。
GUI:
-- QT: NO
-- GTK+ 3.x: YES (ver 3.18.9)
-- GThread : YES (ver 2.48.2)
-- GtkGlExt: NO
-- OpenGL support: NO
-- VTK support: NO
系统gtk信息如下:
$ pkg-config --modversion gtk+-2.0
$ 2.24.30
这就是问题所在。如何使用gtk 2.x 使用cmake 安装opencv?
【问题讨论】:
-
显示您的 CMakeLists.txt 如何检测 GTK。如果它有类似 SET(GTK_PATH /usr/lib/x86_64-linux-gnu/) 的东西,那么你可以改变那个路径。