environment
- Ubuntu 16.04
- Qt 5.12.6
- OpenCV 3.2.0
Problem
[libprotobuf FATAL 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”.)
analysis
- 问题出现:在原有c++工程中添加调用
libdarknet.so
库文件的模块后出现error。原project的proto版本是3.4.0
,不知道从哪冒出来个天使2.6.1
版本与之冲突了。 - 网查答案都在说是
/opt/Qt/5.9/gcc_64/plugins/platformthemes
的库libqgtk3.so
引起的:
Protobuf version conflicts with Qt
这些方法都试了,没用。 - 经历痛苦排查发现,如果在是编译生成
libdarknet.so
库的时候,在Makefile
中启用OPENCV=1
,就会导致这个问题的出现。 - 猜想应该是
OpenCV 3.2.0
编译安装过程中,依赖proto的低版本,导致再去使用OpenCV 3.2.0编译darknet
时,libdarknet.so
依赖于proto的低版本。 - 尝试重装OpenCV。
Solution
- 安装选择
OpenCV 3.4.5
版本,没有啥特别原因,就是正好电脑里有下好的。可参考(ubuntu16.04编译安装opencv3.4.5) - 在安装过程中,通过cmake-gui配置,取消下列3个变量的勾选:
WITH_GTK
WITH_PROTOBUF
BUILD_PROTOBUF
- 安装成功后,重新编译生成
libdarknet.so
,问题解决!