error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’

最近安装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的版本不对。

查了下:

[email protected]:/home/zenggq/mainspace/mscnn$ which protoc
/usr/bin/protoc
[email protected]:/home/zenggq/mainspace/mscnn$

[email protected]:~/zenggq/caffe-bak$ pip show protobuf
Name: protobuf
Version: 3.3.0
Summary: Protocol Buffers
Home-page: https://developers.google.com/protocol-buffers/
Author: [email protected]
Author-email: [email protected]
License: 3-Clause BSD License
Location: /home/sensetime/anaconda2/lib/python2.7/site-packages
Requires: six, setuptools
[email protected]:~/zenggq/caffe-bak$

protoc --version

发现是2.5.0

索性把anaconda2下的protoc文件覆盖/usr/bin/protoc。

搞定。

时间: 2024-10-10 08:36:40

error: ‘kEmptyString’ is not a member of ‘google::protobuf::internal’的相关文章

ImportError:No module named google.protobuf.internal

当在anaconda中import caffe 时提示错误: 1 ImportError:No module named google.protobuf.internal 首先修改访问anaconda2文件夹的权限: 1 sudo chmod 777 -R anaconda2 接着: conda install protobuf 此错误是由于protobuf的版本较低,只要更新为最新版本即可.

google protobuf 使用示例

1 定义.proto接口文件 package tutorial; message Person { required string name = 1; required int32 id = 2; //unique ID number for this person optional string email = 3; enum PhoneType { MOBILE = 0; HOME = 1; WORK = 2; } message PhoneNumber { required string

Google protobuf解析消息逻辑的版本问题

在分析caffe2源码的过程中,由于caffe2使用protobuf作为网络结构和网络参数序列化和反序列化的机制,想在反序列化之前进行加解密处理,这是反向protouf其实有两个版本的实现来进行消息的解析. protobuf 中对消息的解析有两个版本,一个是python版本,另外一个是c++版本.python版本相关的代码存放路径在:./python/google/protobuf/internal/python_message.py 中,而c++实现版本存放路径在:./python/googl

No module named google.protobuf.

import caffe 不成功, 报错"No module named google.protobuf.internal" 方法1:我之前经常会用, 但其实不好用.就是找一个protobuf的包, 然后手动装. 方法2:直接pip install protobuf或者conda install protobuf. 原文地址:https://www.cnblogs.com/liulangdemao/p/9778914.html

caffe make error: class google::protobuf::RepeatedField&lt;unsigned int&gt; has no member named &#39;UnsafeMergeFrom&#39;

之前caffe中protobuf的版本是2.5.0,可在ternimal下执行:protoc --version 查看当前protobuf版本. 由于另外安装了Tensorflow之后,默认对protobuf版本进行了更新,变成3.1.0.于是在caffe中make的时候出现错误,错误提示如下: 将protobuf版本降低为2.5.0后即可解决问题. ... 后续考虑是否可以对caffe进行对应''升级'',使得满足protobuf新版本的问题. caffe make error: class

Solve error: &#39;class vtkImageActor&#39; has no member named &#39;SetInput&#39;

Replacement of SetInput() with SetInputData() and SetInputConnection() someFilter->SetInput(someReader->GetOutput()); // Outdated // Replace to the following: someFilter->SetInputConnection(someReader->GetOutputPort()); someFilter->SetInput

fatal error: google/protobuf/arena.h:没有那个文件或目录

安装caffe时make all会出现这个错误,按照https://github.com/BVLC/caffe/issues/4988说法,可能时libprotobuf-dev过时了,需要从源码重新变异protobuf. 首先安装:sudo apt-get install autoconf automake libtool curl make g++ unzip 接下来参考这篇博客就行了:http://blog.csdn.net/yl204/article/details/50478279 另参

VS下使用Google Protobuf完成SOCKET通信

如何在Windows环境下的VS中安装使用Google Protobuf完成SOCKET通信 出处:如何在Windows环境下的VS中安装使用Google Protobuf完成SOCKET通信 最近一段时间,由于项目的需要,接触到了Protobuf这个东东,在Linux环境下,体验了一把,感觉挺不错,很方便,且高效.是一个非常值得学习掌握和应用的数据抽象.平台无关.功能强大.…(此处省略1000字)的开源工具. Google虽然把Protobuf做成了跨平台.跨语言,但作为微软的死对头,它在re

使用CSharp编写Google Protobuf插件

什么是 Google Protocol Buffer? Google Protocol Buffer( 简称 Protobuf) 是 Google 公司内部的混合语言数据标准,目前已经正在使用的有超过 48,162 种报文格式定义和超过 12,183 个 .proto 文件.他们用于 RPC 系统和持续数据存储系统. Protocol Buffers 是一种轻便高效的结构化数据存储格式,可以用于结构化数据串行化,或者说序列化.它很适合做数据存储或 RPC 数据交换格式.可用于通讯协议.数据存储等