5
votes

I've previously installed caffe and Fast-RCNN, so I should have all the required libraries and dependencies.

I need to install it again for another repository(https://github.com/ronghanghu/natural-language-object-retrieval) that uses Caffe.

When I run

make all

it gives me the following error:

CXX .build_release/src/caffe/proto/caffe.pb.cc
In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:
.build_release/src/caffe/proto/caffe.pb.h:12:2: error: #error This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
^
.build_release/src/caffe/proto/caffe.pb.h:13:2: error: #error incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers.  Please update
^
.build_release/src/caffe/proto/caffe.pb.h:14:2: error: #error your headers.
#error your headers.
^
In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:
.build_release/src/caffe/proto/caffe.pb.h:26:55: fatal error: google/protobuf/generated_enum_reflection.h: No such file or directory
#include <google/protobuf/generated_enum_reflection.h>

compilation terminated.
make: *** [.build_release/src/caffe/proto/caffe.pb.o] Error 1

I thought maybe protobuf has been updated, and tried

protoc --version

which returns

libprotoc 2.5.0

It seems like newer version of protobuf has been released (2.6 or up).

So my question would be:

1) Is there a simple way to update it?

2) If I do update it, will it affect caffe and fast-rcnn that I previously installed, which depends on the older version of protobuf?

4

4 Answers

4
votes

I suspect your problem is that you have multiple versions of protobuf in your include path. It may be picking up the headers from the older version instead of the latest. I can confirm that latest caffe (git master as of right now) compiles cleanly against the libprotobuf-dev-2.5.0-9ubuntu1 which is in ubuntu 14.04LTS.

1
votes

I guess before you get this problem, you have used protoc to generate caffe.pb.h`. If you did, my solution maybe be useful to you.

Firstly, you should know how many protoc installed in your OS.

For example, in my OS:

Prompt> whereis protoc
protoc: /usr/bin/protoc /home/xxx/.conda/envs/python27/bin/protoc/usr/share/man/man1/protoc.1.gz

So, there are 2 protoc in my OS. You can use which protoc and protoc --version in order to find which version protoc is used default. In my OS:

Prompt> which protoc
/home/xxx/.conda/envs/python27/bin/protoc

Prompt>protoc --version
libprotoc 3.5.1

Finally, use another protoc to create caffe.pb.h again. let the dir to caffe/src/caffe/proto, and execute:

/usr/bin/protoc --cpp_out=. caffe.proto
0
votes

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

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

0
votes

I solve the problem by

conda uninstall libprotobuf

then remove the caffe folder and download a new one

git clone https://github.com/BVLC/caffe.git

then do

make all -j8