最近安装caffe,突然报这个错:
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::set_mean_file(const char*)’:
.build_release/src/caffe/proto/caffe.pb.h:17957:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
if (mean_file_ == &::google::protobuf::internal::kEmptyString) {
^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::set_mean_file(const char*, size_t)’:
.build_release/src/caffe/proto/caffe.pb.h:17964:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
if (mean_file_ == &::google::protobuf::internal::kEmptyString) {
^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘std::string* caffe::ImageDataParameter::mutable_mean_file()’:
.build_release/src/caffe/proto/caffe.pb.h:17971:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
if (mean_file_ == &::google::protobuf::internal::kEmptyString) {
^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘std::string* caffe::ImageDataParameter::release_mean_file()’:
.build_release/src/caffe/proto/caffe.pb.h:17978:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
if (mean_file_ == &::google::protobuf::internal::kEmptyString) {
^
.build_release/src/caffe/proto/caffe.pb.h:17982:47: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
mean_file_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::set_allocated_mean_file(std::string*)’:
.build_release/src/caffe/proto/caffe.pb.h:17987:22: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
if (mean_file_ != &::google::protobuf::internal::kEmptyString) {
^
.build_release/src/caffe/proto/caffe.pb.h:17995:47: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
mean_file_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::clear_root_folder()’:
.build_release/src/caffe/proto/caffe.pb.h:18054:24: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
if (root_folder_ != &::google::protobuf::internal::kEmptyString) {
^
.build_release/src/caffe/proto/caffe.pb.h: In member function ‘void caffe::ImageDataParameter::set_root_folder(const string&)’:
.build_release/src/caffe/proto/caffe.pb.h:18064:24: error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’
发现又是protoc的版本不对。
查了下:
sensetime@sensetime-To-be-filled-by-O-E-M:/home/zenggq/mainspace/mscnn$ which protoc
/usr/bin/protoc
sensetime@sensetime-To-be-filled-by-O-E-M:/home/zenggq/mainspace/mscnn$
sensetime@sensetime-To-be-filled-by-O-E-M:~/zenggq/caffe-bak$ pip show protobuf
Name: protobuf
Version: 3.3.0
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: protobuf@googlegroups.com
Author-email: protobuf@googlegroups.com
License: 3-Clause BSD License
Location: /home/sensetime/anaconda2/lib/python2.7/site-packages
Requires: six, setuptools
sensetime@sensetime-To-be-filled-by-O-E-M:~/zenggq/caffe-bak$
protoc --version
发现是2.5.0
索性把anaconda2下的protoc文件覆盖/usr/bin/protoc。
搞定。