如何将GTK3中的google protobuf 2.6.1依赖关系从Google protobuf 3.8.0中分离出来,用于Cmake项目的其他部分。

问题描述 投票:1回答:1

TL;DR",我遇到了与谷歌Protobufs版本不匹配的依赖性问题。

我遇到了谷歌Protobufs版本不匹配的依赖性问题。

结束 TL;DR

我已经使用Google protobufs一段时间了,我遇到了一个奇怪的难题。我已经安装了 3.8.0 的源码,我在一些项目中使用它。我现在正在尝试做一个使用了 GTK3 的图形用户界面。我一直试图运行我的程序,但我一直遇到这个错误。

./runserver.sh 
[libprotobuf FATAL google/protobuf/stubs/common.cc:86] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.8.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.8.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".)
./runserver.sh: line 4:  8205 Aborted                 (core dumped) ./build/src/thechatroom server

我知道我需要安装正确的版本,否则无法运行。问题是,现在不管我做什么(读取变量的 "GUI")。Protobuf_VERSION 在CMake或 protoc --version 在终端上),我总是显示版本 3.8.0 根据这3个问题(以及这些答案中的注释),这是因为 GTK3 取决于谷歌Protobufs的旧版本。

https://stackoverflow.com/questions/47503347/how-to-compile-opencv-with-gtk-2-x-rather-than-gtk3-x
https://stackoverflow.com/questions/41964212/conflict-protobuf-version-when-using-opencv-and-tensorflow-c
https://stackoverflow.com/questions/49823114/google-protobuf-dependency-collision

我应该提到,我得到的是 反面教材 作为这个人。我检测到我的新版本。

那么,我的问题是,我如何隔离旧版本(2.6.1),以实现 GTK3 而在CMake中使用新的版本(3.8.0)?

c++ cmake protocol-buffers gtk3
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.