As a special shortage of laboratory resources, several people on the server share a path of the bitter graduate students, in the face of everyone needs to run Caffe will be very egg pain. In particular, some people at sixes and sevens to install different versions of the PROTOBUF, installed in different paths, how to select a specific version of Caffe compile it.
I am Linux 0 Basic +caffe 0 Foundation, check a lot of data, reluctantly pieced together out how to choose the Protobuf version of the solution.
For example, our server has two versions of PROTOBUF, version 3.1.0 installed under Usr/local/bin, version 3.0.0 installed in $home/anaconda2/bin,
Running in terminal
sudo protoc--version
Shows that the current version is 3.1.0, and the path points to the Usr/local/bin
Protoc--version
The version is 3.0.0 and the path points to $home/anaconda2/bin
Compiling Caffe with
sudo make All-j4
This is a common problem.
In the 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 has generated by a newer version of PROTOC which be
#error this file was gene Rated by a newer version of the Protoc which is
^
. Build_release/src/caffe/proto/caffe.pb.h:13:2: Error: #error incom Patible with your Protocol Buffer headers. Please update
#error the 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.
^
...
This is a classic question, everyone will tell you to reload Protobuf, such as running
sudo apt-get install Libprotobuf-dev
However, for a person who needs a lower version of the PROTOBUF, this command line is not available.
Since I have the right version in my $home/anaconda2/bin, I'm going to use the protobuf directly here, by looking through the data and knowing Sudo, the default environment variable is in the/etc/sudoers file, and in general sudo will reset $path, And the sudoers file has one line
Defaults Secure_path =/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
So sudo $path is read from here, so I just add my path to it, and note that the path is added to the front of the other version path, which determines the reading order.
#Defaults secure_path= "/usr/local/sbin:/usr/local/bin:\ $HOME/anaconda2/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Note that sudoers files are important, remember to back up before modifying
The Secure_path is immediately effective, and this time the sudo version becomes the 3.0.0 version I need.
This is the first step to solve the problem ... There are a variety of questions behind, 1.1 point record it.