gcc-3.4编译google protocol buffer 2.4.0a
2011-04-07 18:10
351 查看
gcc 3.4是比较老的编译器,用它来编译最新版protobuf 2.4.0a的话,可能会有如下错误:
google/protobuf/descriptor.cc: In member function `virtual const google::protobuf::FieldDescriptor* google::protobuf::DescriptorBuilder::OptionInterpreter::AggregateOptionFinder::FindExtension(google::protobuf::Message*, const std::string&) const':
./google/protobuf/descriptor.h:1152: error: `google::protobuf::internal::Mutex*google::protobuf::DescriptorPool::mutex_' is private
google/protobuf/descriptor.cc:4341: error: within this context
./google/protobuf/descriptor.h:1152: error: `google::protobuf::internal::Mutex*google::protobuf::DescriptorPool::mutex_' is private
google/protobuf/descriptor.cc:4342: error: within this context
make[2]: *** [descriptor.lo] Error 1
make[2]: Leaving directory `/home/liangry/download/protobuf-2.4.0a/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/liangry/download/protobuf-2.4.0a'
make: *** [all] Error 2
需打上以下补丁:
在protobuf-2.4.0a编译目录下,把上述内容保存为protobuf_gcc3.4.patch,然后输入以下命令即可。
$ patch -p0 < protobuf_gcc3.4.patch
patching file ./src/google/protobuf/descriptor.cc
参考文章:http://code.google.com/p/protobuf/source/detail?r=380#
google/protobuf/descriptor.cc: In member function `virtual const google::protobuf::FieldDescriptor* google::protobuf::DescriptorBuilder::OptionInterpreter::AggregateOptionFinder::FindExtension(google::protobuf::Message*, const std::string&) const':
./google/protobuf/descriptor.h:1152: error: `google::protobuf::internal::Mutex*google::protobuf::DescriptorPool::mutex_' is private
google/protobuf/descriptor.cc:4341: error: within this context
./google/protobuf/descriptor.h:1152: error: `google::protobuf::internal::Mutex*google::protobuf::DescriptorPool::mutex_' is private
google/protobuf/descriptor.cc:4342: error: within this context
make[2]: *** [descriptor.lo] Error 1
make[2]: Leaving directory `/home/liangry/download/protobuf-2.4.0a/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/liangry/download/protobuf-2.4.0a'
make: *** [all] Error 2
需打上以下补丁:
--- ./src/google/protobuf/descriptor.cc 2011-02-02 22:08:47.000000000 +0800 +++ ./src/google/protobuf/descriptor.cc 2011-04-07 10:35:29.000000000 +0800 @@ -2160,6 +2160,11 @@ static inline bool get_is_placeholder(const Descriptor* descriptor) { return descriptor->is_placeholder_; } + static inline void assert_mutex_held(const DescriptorPool* pool) { + if (pool->mutex_ != NULL) { + pool->mutex_->AssertHeld(); + } + } // Must be run only after options have been interpreted. // @@ -4338,9 +4343,12 @@ virtual const FieldDescriptor* FindExtension( Message* message, const string& name) const { + /* if (builder_->pool_->mutex_ != NULL) { builder_->pool_->mutex_->AssertHeld(); } + */ + assert_mutex_held(builder_->pool_); Symbol result = builder_->LookupSymbolNoPlaceholder( name, message->GetDescriptor()->full_name()); if (result.type == Symbol::FIELD &&
在protobuf-2.4.0a编译目录下,把上述内容保存为protobuf_gcc3.4.patch,然后输入以下命令即可。
$ patch -p0 < protobuf_gcc3.4.patch
patching file ./src/google/protobuf/descriptor.cc
参考文章:http://code.google.com/p/protobuf/source/detail?r=380#
相关文章推荐
- 使用NDK编译Google Protocol Buffer
- windows下Google Protocol Buffer 编译安装(vs)教程
- windows下Google Protocol Buffer 编译安装教程
- Google protocol buffer在windows下的编译
- Google Protocol Buffer安装编译及使用
- windows下Google Protocol Buffer 编译安装教程
- windows下Google Protocol Buffer 编译安装教程
- Google Protocol Buffer安装编译及使用
- 由Google Protocol Buffer的小例子引起的g++编译问题
- Android NDK下编译google protocol buffer
- Google protocol buffer在windows下的编译
- 关于 Google Protocol Buffer 和 常见Blas
- Google Protocol Buffer 的使用和原理
- Google Protocol Buffer 的使用和原理
- Google protocol buffer程序书写小结
- google protocol buffer -2-.proto 定义规则
- linux下gcc编译使用opencv的源文件时报错的处理:undefined reference to symbol '_ZNSsD1Ev@@GLIBCXX_3.4'
- Google Protocol Buffer 的使用和原理
- Google Protocol Buffer 的使用和原理