Google protocol buffer (Protobuf) version conflict on Linux systems
System & Environment: Linux Ubuntu (16.04 LTS), Miniconda (version 4.5.0)
What is Protobuf:
Protobuf is used to describe the data structure in a .proto file. Protocol buffer compiler creates a class that implements automatic encoding and parsing of the protocol buffer data with an efficient binary format. The generated class provides getters and setters for the fields that make up a protocol buffer and takes care of the details of reading and writing the protocol buffer as a unit. Importantly, the protocol buffer format supports the idea of extending the format over time in such a way that the code can still read data encoded with the old format. A detailed description and tutorial can be accessed from Google developer site:
Common Problem/ Error: Protobuf compiler version doesn't match library version
The version mismatch creates difficulties in compiling dependent libraries like OpenCV. This generally happens due to different versions of protobuf on the system and python libraries installed by Anaconda. Linux Ubuntu (16.04 LTS) have default protobuf version 2.6.1. Anaconda python protobuf library version currently is 3.4.0.
One possible way to overcome this issue is to explicitly provide Protobuf paths as parameters.
For example, while compling OpenCV on our system, we used following switches in the CMake file:
-D Protobuf_PROTOC_EXECUTABLE=/opt/miniconda/pkgs/libprotobuf-3.4.1-h5b8497f_0/bin/protoc \ -D Protobuf_INCLUDE_DIR=/opt/miniconda/pkgs/libprotobuf-3.4.1-h5b8497f_0/include/ \ -D Protobuf_LIB_VERSION=/opt/miniconda/pkgs/libprotobuf-3.4.1-h5b8497f_0/include/ \