昨天编译caffe时候遇到的,很久没编译了,发现现在caffe的版本升级了。用gcc-4.8和g++-4.8都会报错:

/,libcaffe.so :std :undefined: vectorreference< unsignedto  char`,google :std:::protobufallocator:<:unsignedinternal :char:>StringTypeHandlerBase :>:&,New (std):':
vector.<build_releaseint/,lib /stdlibcaffe.so::: allocatorundefined< int>reference  >to  const`&google):':
protobuf.:build_release:/internallib:/:libcaffe.so:WireFormatLite :undefined: WriteBytesMaybeAliasedreference( intto,  `stdgoogle::::stringprotobuf :const:&internal,: :googleWireFormatLite::::protobufWriteBytesMaybeAliased:(:intio,: :stdCodedOutputStream:*:)string'
const.&build_release,/ libgoogle/:libcaffe.so::protobuf :undefined: ioreference: :toCodedOutputStream *`)leveldb':
:.Statusbuild_release:/:libToString/(libcaffe.so):  constundefined'
reference. build_releaseto/ lib`/leveldblibcaffe.so::: Statusundefined: :referenceToString (to)  `constgoogle':
:.protobufbuild_release:/:libinternal/:libcaffe.so::WireFormatLite :undefined: WriteStringreference( intto,  `stdgoogle::::stringprotobuf :const:&internal,: :googleWireFormatLite::::protobufWriteString:(:intio,: :stdCodedOutputStream:*:)string'
const&, google::protobuf::io::CodedOutputStreamMakefile:640: recipe for target '.build_release/examples/cpp_classification/classification.bin' failed
*)'make: *** [.build_release/examples/cpp_classification/classification.bin] Error 1

make: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
Makefile:635: recipe for target '.build_release/tools/caffe.bin' failed
make: *** [.build_release/tools/caffe.bin] Error 1
Makefile:640: recipe for target '.build_release/examples/mnist/convert_mnist_data.bin' failed
make: *** [.build_release/examples/mnist/convert_mnist_data.bin] Error 1
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::InitializationErrorString() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::GetTypeName() const'
.build_release/lib/libcaffe.so: undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::DebugString() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::empty_string_'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::MessageLite::ParseFromString(std::string const&)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::string const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::string const&) const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))'
.build_release/lib/libcaffe.so: undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(std::string const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> >. build_releaseconst/&examples)/'siamese
/.convert_mnist_siamese_data.obuild_release:/ libIn/ libcaffe.sofunction:  `undefinedconvert_dataset (referencechar  toconst *`,google :char: protobufconst:*:,internal :char: StringTypeHandlerBaseconst:*:)New'(:)
'convert_mnist_siamese_data.cpp
:.(build_release./textlib+/0x4cdlibcaffe.so)::  undefinedundefined  referencereference  toto  ``googleleveldb::::protobufDB::::internalOpen:(:leveldbWireFormatLite::::OptionsWriteBytesMaybeAliased (constint&,,  stdstd::::stringstring  constconst&&,,  googleleveldb::::protobufDB:*:*io):':
CodedOutputStreamconvert_mnist_siamese_data.cpp*:)('.
text.+build_release0x8e7/)lib:/ libcaffe.soundefined:  referenceundefined  toreference  `togoogle :`:leveldbprotobuf::::Statusinternal::::ToStringempty_string_(')
 convert_mnist_siamese_data.cppconst:'(
..textbuild_release+/0x94blib)/:libcaffe.so :undefined  undefinedreference  referenceto  to` google`:google::protobuf::protobuf::MessageLite::internal::SerializeToString:(WireFormatLitestd::::WriteStringstring(*int),  conststd':
:.stringbuild_release /constexamples&/,siamese /google:convert_mnist_siamese_data.o::protobuf :In: iofunction: :`CodedOutputStreamstd*:):'string
* google::MakeCheckOpString<unsigned int, int>(unsigned int const&, int const&, char collect2: error: ld returned 1 exit status
const*)':
convert_mnist_siamese_data.cpp:(.text._ZN6google17MakeCheckOpStringIjiEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIjiEEPSsRKT_RKT0_PKc]+0x43): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
.build_release/examples/siamese/convert_mnist_siamese_data.o: In function `std::string* google::MakeCheckOpString<unsigned int, unsigned int>(unsigned int const&, unsigned int const&, char const*)':
convert_mnist_siamese_data.cpp:(.text._ZN6google17MakeCheckOpStringIjjEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringIjjEEPSsRKT_RKT0_PKc]+0x43): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::InitializationErrorString() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned charMakefile:635: recipe for target '.build_release/tools/upgrade_net_proto_text.bin' failed
*)'
.build_releasemake: *** [.build_release/tools/upgrade_net_proto_text.bin] Error 1
/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::GetTypeName() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::DebugString() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::MessageLite::ParseFromString(std::string const&)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::string const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::string const&) const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(std::string const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::StringTypeHandlerBase::New()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
.build_release/lib/libcaffe.so: undefined reference to `leveldb::Status::ToString() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
collect2: error: ld returned 1 exit status
.build_release/tools/extract_features.o: In function `std::string* google::MakeCheckOpString<int, int>(int const&, int const&, char const*)':
extract_features.cpp:(.text._ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKcMakefile:640: recipe for target '.build_release/examples/siamese/convert_mnist_siamese_data.bin' failed
[_ZN6google17MakeCheckOpStringIiiEEPSsRKT_RKT0_PKcmake: *** [.build_release/examples/siamese/convert_mnist_siamese_data.bin] Error 1
]+0x43): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
.build_release/tools/extract_features.o: In function `std::string* google::MakeCheckOpString<unsigned long, unsigned long>(unsigned long const&, unsigned long const&, char const*)':
extract_features.cpp:(.text._ZN6google17MakeCheckOpStringImmEEPSsRKT_RKT0_PKc[_ZN6google17MakeCheckOpStringImmEEPSsRKT_RKT0_PKc]+0x44): undefined reference to `google::base::CheckOpMessageBuilder::NewString()'
.build_release/tools/extract_features.o: In function `int feature_extraction_pipeline<float>(int, char**)':
extract_features.cpp:(.text._Z27feature_extraction_pipelineIfEiiPPc[_Z27feature_extraction_pipelineIfEiiPPc]+0xb6d): undefined reference to `google::protobuf::internal::empty_string_'
extract_features.cpp:(.text._Z27feature_extraction_pipelineIfEiiPPc[_Z27feature_extraction_pipelineIfEiiPPc]+0x122f): undefined reference to `google::protobuf::MessageLite::SerializeToString(std::string*) const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::InitializationErrorString() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::io::CodedOutputStream::WriteStringWithSizeToArray(std::string const&, unsigned char*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*, std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::GetTypeName() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::Message::DebugString() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::MessageLite::ParseFromString(std::string const&)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(std::string const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::DescriptorPool::FindFileByName(std::string const&) const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::ReadBytes(google::protobuf::io::CodedInputStream*, std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::StringTypeHandlerBase::Delete(std::string*)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const*, void (*)(std::string const&))'
.build_release/lib/libcaffe.so: undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::string const&, leveldb::DB**)'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(std::string const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::StringTypeHandlerBase::New()'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
.build_release/lib/libcaffe.so: undefined reference to `leveldb::Status::ToString() const'
.build_release/lib/libcaffe.so: undefined reference to `google::protobuf::internal::WireFormatLite::WriteString(int, std::string const&, google::protobuf::io::CodedOutputStream*)'
collect2: error: ld returned 1 exit status
Makefile:635: recipe for target '.build_release/tools/extract_features.bin' failed
make: *** [.build_release/tools/extract_features.bin] Error 1

查了很多资料,开始说是protoc的故障,但是实验了一大堆,均没有解决,最后发现要升级gcc和g++了。具体操作如下:

    cd /usr/bin

    ls -l gcc* cpp g++

发现gcc和g++都是链接的4.*版本。确认自己/usr/bin存在5.0版本下。删除以前的软连接,执行:

sudo rm /usr/bin/gcc /usr/bin/g++

然后创建新的软连接:

sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc

sudo ln -s /usr/bin/g++-5 /usr/bin/g++

重新编译,解决bug.

reference:https://askubuntu.com/questions/372248/downloaded-g-4-8-from-the-ppa-but-cant-set-it-as-default

ubuntu16.04 升级gcc,g++相关推荐

  1. ubuntu16.04安装gcc g++7.5.0及各个版本的切换

    sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-7 s ...

  2. Ubuntu14.04 LTS中升级gcc/g++版本到4.9.4的操作步骤

    Ubuntu14.04 LTS中默认的gcc/g++版本为4.8.4,如下图,在C++11中增加了对正则表达式的支持,但是好像到gcc/g++ 4.9.2版本才会对正则表达式能很好的支持,这里介绍下U ...

  3. 【转】CentOS 6.6 升级GCC G++ (当前最新版本为v6.1.0) (完整)

    原文地址:https://www.cnblogs.com/lzpong/p/5755678.html 我这里是centos7 升级到gcc8.1,过程差不多,参考这篇文章,记录一下. ---原文--- ...

  4. gtk linux 升级_Linux包系列的知识(附:Ubuntu16.04升级到18.04的案例)

    Linux包系列的知识(附:Ubuntu16.04升级到18.04的案例) 发布时间:2018-05-27 12:30, 浏览次数:424 , 标签: Linux Ubuntu Linux基础:htt ...

  5. 【Tools】ubuntu16.04升级Python2.7到3.5

    最近开始学Python,但我发现我ubuntu16.04上默认的Python是2.7,并不是3,x 于是准备Python升级,记录安装过程给初学者参考一下. 1.先取得管理员权限, 个人习惯先取得管理 ...

  6. ubuntu16.04 升级内核

    一.环境 在虚拟机上运行的ubuntu16.04 , 使用命令uname -r查看当前系统内核版本 当前版本为4.15.0-45-generic.                要升级的内核为4.20 ...

  7. Ubuntu16.04升级内核并卸载不常用软件

    给新买的MSI GL62M装了ubuntu16.04,开机发现特别卡,于是安装stacer这款图形化系统监控软件查看系统运行状况. 打开一看吓了一跳,4核CPU超线程,8个核有两个核总是100%负载, ...

  8. 【从Ubuntu16.04升级Ubuntu18.04,并安装ROS系统】熟能生巧,避坑专用

    前言 本来用的是Ubuntu16.04,现升级为Ubuntu18.04. 因为使用了挺长时间的16.04版本,安装了一些第三方软件,升级时在清除第三方软件时总是清不干净,读了升级失败的日志后发现原来是 ...

  9. 阿里云Ubuntu16.04升级python3.6和pip

    ubuntu16.04安装python3.6 一.Python3.6 ubuntu16.04默认的软件repository中并不包含python3.6(最高到python3.5),所以无法通过命令ap ...

最新文章

  1. mysql创建表的时候显式申明字符集
  2. 16个不错的 git 别名
  3. axios02-其他使用方式(推荐)
  4. 面试-设计模式六大原则
  5. 验证二叉搜索树Python解法
  6. Dart基础学习02--变量及内置类型
  7. JAVA中的那些名词解释
  8. perl 如何判断变量为空
  9. ASP.NET MVC下基于异常处理的完整解决方案
  10. hdfs+zookeeper+hbase分布式在k8s中部署(本文已过期)
  11. 【算法学习】【图像增强】【Retinex】White Patch Retinex 程序解读
  12. 小D课堂 - 新版本微服务springcloud+Docker教程_4-01 常用的服务间调用方式讲解
  13. win11笔记本没有网络图标问题的解决历程
  14. 从零开始的车牌识别课题设计(一)
  15. ssr提示服务器名无效_联想服务器在UEFI HII界面中配置阵列的基本操作
  16. nividia-smi命令不显示占用显卡的进程
  17. 数字人民币专利数激增, “区块链”领域大有可为
  18. 藏苹果 HNSUT 1889
  19. linux websphere 端口号,Linux环境下配置websphere7.0的一些命令
  20. 左右连接之where

热门文章

  1. U3D第二天学习心得
  2. 深入了解计算机网络知识面,南京理工大学2019年网络空间安全专业介绍
  3. es的分片和副本_Elasticsearch的分布式存储与分片内部原理
  4. 论坛报名 | 负责任的人工智能:可持续发展与治理的协同
  5. android 点击屏幕关闭软键盘
  6. 内置CRC于hex程序中的方法
  7. win7老自动关pr打印服务器,请问win7系统的pscc肿么打印不了,一打印就自动关闭程序!...
  8. Android UI设计和形成原理(实现三级菜单)
  9. 《惢客创业日记》2019.07.24(周三)从产品角度理解“为腹不为目”
  10. 数据库三范式【看了就有收获,最简单的例子解释】