3
votes

I have some issues with installing OpenCV with contrib modules from sources codes and Protobuf libraries.

I have a program, that needs Protobuf 3.1. and OpenCV 3.2 with contrib modules. After compiling and installing both from sources, the program itself compiles and linked well. When executing the program, I get the following error:

[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.1.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-pkdHET/mir-0.21.0+16.04.20160330/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.1.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-pkdHET/mir-0.21.0+16.04.20160330/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)

Checking the linked libraries of my software, I see that protobuf was included in 2.6. (so.9) and 3.1 (so.11) as well as libmir*.so

ldd localization | grep protobuf*
libprotobuf.so.11 => /usr/local/lib/libprotobuf.so.11 (0x00007f1797df8000)
libmirprotobuf.so.3 => /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3 (0x00007f178a751000)
libprotobuf-lite.so.9 => /usr/lib/x86_64-linux-gnu/libprotobuf-lite.so.9 (0x00007f178a31b000)

Looking into the linked libraries, I found out that Opencv linked

  • libmir libraries (which are using protobuf) with
  • Protobuf 2.6 (libprotobuf-lite.so.9 in usr/lib/x86_64-linux-gnu/)

while my Protobuf 3.1 is in /usr/local/ Also opencv uses libprotobuf 3.1. when building DNN parts etc.

~$ ldd /usr/local/bin/opencv* | grep libproto* 
libprotobuf-lite.so.9 => /usr/lib/x86_64-linux-gnu/libprotobuf-lite.so.9

ldd /usr/local/bin/opencv* | grep libmir*
libmirclient.so.9 => /usr/lib/x86_64-linux-gnu/libmirclient.so.9 (0x00007f1d59b4c000)
libmircommon.so.5 => /usr/lib/x86_64-linux-gnu/libmircommon.so.5 (0x00007f1d56d5f000)
libmirprotobuf.so.3 => /usr/lib/x86_64-linux-gnu/libmirprotobuf.so.3 (0x00007f1d56afe000)
  • What is libmir* (libmirclient9 or libmirclient-dev or libmircommon5 etc. are installed via apt apparently) and what is it used for / by?
  • Which part / library / module of Opencv 3 uses libprotobuf 2.6 and libmir?
  • How can I configure a build of Opencv 3 not using any protobuf library (or which links to it)
  • Any other way to compile my own program without protobuf 2.6 or libmirprotobuf

Thank you very much for your effort.

BR Florian

1

1 Answers

2
votes

Ok, building WITH_QT=ON removes the need for libmir and therefore libprotobuf 2.6

here is the full cmake command, that worked:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..