在编译py-faster-rcnn的pycaffe时出现以上错误:
CXX .build_release/src/caffe/proto/caffe.pb.cc
CXX src/caffe/blob.cpp
CXX src/caffe/data_transformer.cpp
CXX src/caffe/net.cpp
CXX src/caffe/solver.cpp
CXX src/caffe/util/insert_splits.cpp
CXX src/caffe/util/db.cpp
CXX src/caffe/util/upgrade_proto.cpp
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.
^
.build_release/src/caffe/proto/caffe.pb.h:22:35: fatal error: google/protobuf/arena.h: 没有那个文件或目录
#include <google/protobuf/arena.h>
^
compilation terminated.
原因: it is because of the wrong version of protobuf
首先你要卸载,并重装其要求的protobuf版本(2.6.1),之后重新编译就好了
卸载办法:
#remove
sudo apt-get remove libprotobuf-dev protobuf-compiler
sudo apt-get remove libprotobuf-lite8 libprotoc8
sudo apt-get remove python-protobuf
sudo pip uninstall protobuf
#如果安装了anaconda
conda uninstall protobuf
如果出现错误:
E:Encountered a section with no Package: header,
输入以下命令:
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update
#reinstall
sudo apt-get install libprotobuf-dev protobuf-compiler
#if anaconda
conda install -c anaconda protobuf=2.6.1
或者
/home/username/anaconda2/bin/pip install protobuf == 2.6.1
附注:
查看当前protoc版本:protoc --version
查看protoc安装位置:which protoc
查找protoc相关文件:sudo find / -name protoc
手动安装protobuf 2.6.1方法:
http://www.cnblogs.com/javaee6/p/4849051.html