caffe: error with protobuf version - computer-vision

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?

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.

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

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.

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

Related

After installing a Library through conda, compiling a C++ script, won't see its headers files

I have already compiled a Script on my Desktop Computer, but now I have to compile it on a Server where I don't have root access.
So I chose to install Anaconda and work with Conda environments.
So, I'm installing a GCC 9.3 Compiler, among with a GXX 9.3 Compiler because I need the execution policies from C17++.
I also installed GSL library through conda install gsl and indeed, on conda list it appears to be:
gsl 2.4 h14c3975_4
so, I decided to compile the script via : x86_64-conda_cos6-linux-gnu-cpp SCRIPT_NAME -o _OUTNAME_ -lgsl since this is the way Anaconda says to call it's compilers (said so on build log)
but I get this error:
mpi_final.cpp:1:10: fatal error: gsl/gsl_math.h: No such file or directory
1 | #include <gsl/gsl_math.h>
| ^~~~~~~~~~~~~~~~
compilation terminated
I have managed to include GSL but ONLY when I install it manually. and then I have problem with other libraries, so I decided to fix anaconda environments. But I dont know how to proceed.
Any Idea on where to look?

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
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.

Compile faster_rcnn_cplusplus and caffe example with correct protobuf

I Installed protobuffer 3.3.0 form a source code instead of version 2.6.1 used "make" to make caffe, tested it, and tried to compile faster_rcnn_cplusplus
Unfortunately it gives ma an error:
/home/adzhus/Workspace/Faster-RCNN-CPP-1/faster_rcnn_cplusplus/py-faster-rcnn/caffe-fast-rcnn/include/caffe/proto/caffe.pb.h:17:2: error: #error This file was generated by an older version of protoc which is...
Path is seems to be correct.
I also checked protoc --version which gives me libprotoc 3.3.0, but for some reason apt-get upgrade libprotobuf-dev gives me ibprotobuf-dev is already the newest version (2.6.1-1.3).
Could someone,please, advice how to fix the compilation error ?
Problem is solved for me.
I just copied caffe.pb.h from ...caffe-fast-rcnn/build/src/caffe/proto to ...caffe-fast-rcnn/include/caffe/proto

Protocol Buffer Error on compile during GOOGLE_PROTOBUF_MIN_PROTOC_VERSION check

I'm currently getting an error which points me to these lines in the header file produced by protoc:
#if 2006001 < 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
But my protoc version matches the one above:
protoc --version
libprotoc 2.6.1
What am I doing wrong?
Originally my protoc version was 3.0.0 then reinstalled it by syncing back to 2.6.1 and doing the steps; make distclean, ./configure , make, make install to install the desired 2.6.1 version. I needed the older version since that's the one installed in our servers.
The problem is that the installed headers on your system (in /usr/include/google/protobuf or /usr/local/include/google/protobuf) are from a newer version of Protocol Buffers than your protoc. It may be the case that you have both versions installed in different locations, and the wrong one is being used.
But my protoc version matches the one above:
Yes, because that code was generated by your protoc, and it knows its own version. The code is asking: "Is my version (2006001) less than the minimum version which the installed headers claim is required (GOOGLE_PROTOBUF_MIN_PROTOC_VERSION)?"

Boost C++ library Version Issue

After downloading and untar the file "boost_1_56_0.tar.gz", I have installed Boost C++ library version "boost_1_56_0" in CentOS Linux.
I have run the following commands to install:
sudo ./bootstrap.sh --prefix=/usr/local
sudo ./b2 install.
I also added two paths to the PATH variable:
export PATH=$PATH:/usr/local/include/:/usr/local/lib/
It has been successfully installed. However when I checked the version it showed different version:
$ cat /usr/include/boost/version.hpp | grep "BOOST_LIB_VERSION"
#define BOOST_LIB_VERSION "1_33_1"
I have tried to install boost_1_55_0 as well in another folder but unfortunately still it shows version 1_33_1.
Can anyone here tell me how I can fix this issue?
Because of this issue, I am unable to configure Graph_tool; it shows following error:
checking for boostlib >= 1.53.0... configure: error: We could not detect the boost libraries (version 1.53 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in . See http://randspringer.de/boost for more documentation>
Your bootstrap path is /usr/local. Make sure your BOOST_ROOT points to your bootstrapped folder, not the installed 1.33 version.