Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protocol Buffer Error version

I'm trying to install the Caffe library but I have a compilation problem due to a wrong protobuf version installed in my system.

In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:
.build_release/src/caffe/proto/caffe.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
 #error This file was generated by an older version of protoc which is
  ^
.build_release/src/caffe/proto/caffe.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
 #error incompatible with your Protocol Buffer headers.  Please
  ^
.build_release/src/caffe/proto/caffe.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.
 #error regenerate this file with a newer version of protoc.

I followed many of the proposed approaches in the forum and I think that the most similar problem was discussed in this post.

In the caffe.pb.h the control is:

#if 3002000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers.  Please
#error regenerate this file with a newer version of protoc.
#endif

However in my system header (/usr/include/google/protobuf/stubs/common.h):

The current version, represented as a single integer to make comparison
easier:  major * 10^6 + minor * 10^3 + micro
define GOOGLE_PROTOBUF_VERSION 2005000

From the terminal the command protoc --version returns libprotoc 3.2.0.

So I've installed the 3.2 version but the system headers are not updated. One user in the previous post commented 'I figured out a way by specifying the protobuf I want first in the PATH variable, without having to remove the other version of protobuf (other things depended on that old version).'

Can someone explain me step by step how can I follow this? Alternatively can I update the system headers? There are many elements that are connected to the libprotoc so I would like to avoid to damage them.

Thanks

like image 635
Luca Avatar asked Jul 12 '17 08:07

Luca


1 Answers

I solved this on my computer and maybe it can help you. My environment is Ubuntu16.04, and I installed Anaconda(for python2.7) before I install Caffe. It happens that I used conda to install libprotobuf-dev, and this leads to conflict with the caffe's 'sudo apt-get install libprotobuf-dev' command, for 'apt-get' and conda installed different on my computer which can be find by 'locate protobuf', so I remove the Anaconda's version of libprotobuf, and no problem happens again.

conda uninstall libprotobuf
conda uninstall protobuf

When you install tensorflow before install Caffe, this problem will also happen, because of the libprotobuf conflict.

like image 118
demianzhang Avatar answered Oct 20 '22 18:10

demianzhang