1. 程式人生 > >Ubuntu中libprotobuf版本衝突的解決方案

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  

 

.