个人微信公众号:AI研习图书馆
ID:(Art-Intelligence)
欢迎关注,交流学习,共同进步~
1. 引言
一如Caffe深似海,从此Torch是路人~
Caffe学习第一步,搭建Caffe环境,编译一个基础的caffe~
但是很多深度学习小白,在这第一步一走就是一个周甚至更久,尤其是caffe-GPU版本的编译,本文主要记录一些常见caffe编译错误,曾经编译无数caffe,每一次,最后成功的那一刻,几乎都留下了热泪…
持续为大家采坑,有需要请移步我的其它文章~
caffe-CPU版安装:
Caffe安装教程:Ubuntu16.04(CPU)
caffe-GPU版安装:
Ubuntu16.04 Caffe(GPU版)详细安装教程
2. caffe编译常见错误及解决方案
问题1:编译选项问题
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
/usr/include/c++/4.9/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the
/usr/local/include/google/protobuf/arena.h:324:36: note: template argument deduction/substitution failed:
Makefile:600: recipe for target ‘.build_release/src/caffe/proto/caffe.pb.o’ failed
make: *** [.build_release/src/caffe/proto/caffe.pb.o] Error 1
解决方法
方法1:
这是由于没有在makefile文件中导入c++11版本,因此打开makefile后,在COMMON_FLAGS后加入-std=c++11 #update by holobo语句,如下:
方法2:
在Makefile文件中找到:
##############################
#configure build
##############################
找到:
#Linux
添加:CXXFLAGS += -std=c++11
安装上面的方法一开始没报错,但过了一段时间后还是报同样的错误,再进一步如下修改,打开Makefile文件,给CXXFLAGS、NVCCFLAGS、LINKFLAGS都使用-std=c++11标准编译:
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
改为:
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS)
改为:
NVCCFLAGS += -D_FORCE_INLINES -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) -std=c++11
LINKFLAGS &#