【caffe】ubuntu16.04安装caffe问题记录

安装可参考:

  1. ubuntu16.04安装caffe
  2. https://blog.csdn.net/u012505617/article/details/88532982

1. nvcc fatal : Unsupported gpu architecture ‘compute_20’

nvcc fatal : Unsupported gpu architecture ‘compute_20’
nvcc fatal : Unsupported gpu architecture ‘compute_20’
nvcc fatal : Unsupported gpu architecture ‘compute_20’
nvcc fatal : Unsupported gpu architecture ‘compute_20’

解决
Makefile.configCUDA_ARCH前两行注释掉

CUDA_ARCH := # -gencode arch=compute_20,code=sm_20 \
		# -gencode arch=compute_20,code=sm_21 \
		-gencode arch=compute_30,code=sm_30 \
		-gencode arch=compute_35,code=sm_35 \
		-gencode arch=compute_50,code=sm_50 \
		-gencode arch=compute_52,code=sm_52 \
		-gencode arch=compute_60,code=sm_60 \
		-gencode arch=compute_61,code=sm_61 \
		-gencode arch=compute_61,code=compute_61

2. /usr/local/include/c++/5.4.0/bits/c++0x_warning.h:32:2: 错误:#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.

#error This file requires compiler and library support \

解决
参考自:https://blog.csdn.net/u012505617/article/details/88532982
打开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 += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS)
改为:
LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) -std=c++11

3. ImportError: libcaffe.so.1.1.0: cannot open shared object file: No such file or directory

make clean,然后重新编译了

make all -j8
make pycaffe -j8

4. ImportError: No module named protobuf.internal

pip install protobuf
但是python2不能安装了。把caffe改为python3.5的支持。

5. ubuntu16.04安装caffe,支持python3.5

参考:https://www.cnblogs.com/hanjianjian90/p/10604926.html

1. 注意python3.5支持的地方修改

PYTHON_LIBRARIES := boost_python3-py35 python3.5m
PYTHON_INCLUDE := /usr/include/python3.5m \
                /usr/lib/python3.5/dist-packages/numpy/core/include

报错/usr/bin/x86_64-linux-gnu-ld: 找不到 -lboost_python3-py35

2 . 按https://www.cnblogs.com/hanjianjian90/p/10604926.html建立软链接python3的软链接
https://www.cnblogs.com/hanjianjian90/p/10604926.html
ln -s /usr/local/python3/bin/python3.5 /usr/bin/python3 这是修改默认的python

  1. 报错
    Makefile:638: recipe for target ‘.build_release/tools/upgrade_net_proto_binary.bin’ failed
    make: *** [.build_release/tools/upgrade_net_proto_binary.bin] Error 1
    .build_release/lib/libcaffe.so:对‘cv::_OutputArray::_OutputArray(cv::Mat&)’未定义的引用
    .build_release/lib/libcaffe.so:对‘cv::_InputArray::_InputArray(cv::Mat const&)’未定义的引用
    .build_release/lib/libcaffe.so:对‘vtable for cv::_InputArray’未定义的引用

把opencv的支持去掉,我编译的是opencv2,caffe好像要3开始的版本。

  1. import caffe时报错
    ImportError: No module named ‘google’

pip install protobuf

你可能感兴趣的:(caffe)