Ubuntu中libprotobuf版本冲突的解决方案

先说解决方法:

因为我出现这个比较奇特,我再下面环境中的第一个项目有这个问题,但是不知道怎么瞎折腾就搞定了,不报这个异常了

不论是Qt Creator直接运行Debug或者Release都没问题

但是我后续建立的项目始终有这个问题,经过几天的折腾发现新项目如果使用sudo命令启动程序就不会报异常,所以目前我的Qt Creator也用sudo命令启动。

下面的方法我都没有尝试过,但是应该最贴近根本原因的。

至于为什么同一个Qt Creator创建并打开的第一个项目正常,但是后续的就异常,目前还不清楚,后续调查清楚了再来更新。

先介绍一下环境:

Ubuntu 16.04

Qt 5.10

Caffe封装的人脸检测库

错误原因:

Caffe中用到的libprotobuf版本与Qt中引用的版本冲突

具体异常如下:

Debugging starts

[libprotobuf FATAL google/protobuf/stubs/common.cc:78] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.3.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.3.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".)

程序异常堆栈如下:

网络上找到的靠谱资源:

c++ - Protobuf version conflicts with Qt - Stack Overflow  

Qt for Linux/X11 - Building from Source | Qt 5.11  

 ParaView built with Qt 5.X linux release fails with protobuf error (#17751) · Issues · ParaView / ParaView · GitLab  

.

原文地址:https://www.cnblogs.com/zhehan54/p/9983794.html