Makefile:589: recipe for target '.build_release/src/caffe/proto/caffe.pb.o' failed

今天在装caffe的时候,编译的时候遇到了一点问题,错误信息如下:

.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.
  ^
Makefile:582: recipe for target '.build_release/src/caffe/syncedmem.o' failed
make: *** [.build_release/src/caffe/syncedmem.o] Error 1
make: *** Waiting for unfinished jobs....
In file included from ./include/caffe/util/cudnn.hpp:8:0,
                 from ./include/caffe/util/device_alternate.hpp:40,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/blob.hpp:8,
                 from src/caffe/layers/rnn_layer.cpp:4:
.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.
  ^
Makefile:582: recipe for target '.build_release/src/caffe/layers/rnn_layer.o' failed
make: *** [.build_release/src/caffe/layers/rnn_layer.o] Error 1
In file included from ./include/caffe/util/cudnn.hpp:8:0,
                 from ./include/caffe/util/device_alternate.hpp:40,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/blob.hpp:8,
                 from ./include/caffe/layers/exp_layer.hpp:6,
                 from src/caffe/layers/exp_layer.cpp:3:
.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.
  ^
Makefile:582: recipe for target '.build_release/src/caffe/layers/exp_layer.o' failed
make: *** [.build_release/src/caffe/layers/exp_layer.o] Error 1
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.
  ^
Makefile:589: recipe for target '.build_release/src/caffe/proto/caffe.pb.o' failed
make: *** [.build_release/src/caffe/proto/caffe.pb.o] Error 1

我输入的命令为,在caffe目录下:

make all -j8

好像是protobuf出现了问题,于是我自己编译了一个:

https://github.com/google/protobuf/releases?after=v3.4.0rc1

首先安装工具:

sudo apt-get install autoconf automake libtool
sudo apt-get install libffi-dev
sudo apt-get install curl

然后我下载的是3.1版本,然后解压,运行:


tar -xvf protobuf-3.1.0.tar.gz
./autogen.sh 
./configure  --prefix=/usr/local/protobuf
make
make check
sudo make install

然后加环境变量,vim /etc/profile

export PATH=$PATH:/usr/local/protobuf/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/protobuf/lib

生效:

source /etc/profile
然后就行了。


参考文献

[1].caffe build problem.https://github.com/BVLC/caffe/issues/3671

[2].protobuf 3.1.0 安装示例和使用指南说明.http://blog.csdn.net/mircosheng/article/details/70141704

[3].autoreconf: not found.http://blog.csdn.net/x356982611/article/details/70856470

你可能感兴趣的:(caffe)