https://blog.csdn.net/weixin_38883095/article/details/106138238
sudo apt install caffe-cuda --fix-missing
make -j8 && make pycaffe
sudo apt install protobuf-compiler
sudo apt-get install libgoogle-glog-dev
1.caffe/blob.hpp:9:34: fatal error: caffe/proto/caffe.pb.h: 没有那个文件或目录
protoc src/caffe/proto/caffe.proto --cpp_out=.
mkdir include/caffe/proto
mv src/caffe/proto/caffe.pb.h include/caffe/proto
2..build_release/src/caffe/proto/caffe.pb.h:9:10: fatal error: google/protobuf/stubs/common.h: No such file or directory
protoc --version
libprotoc 3.0.0
caffe需要protoc版本为2,ProtoBuf 2.6.1安装、配置、卸载
https://blog.csdn.net/blue_it/article/details/53996216
sudo ln -s usr/local/bin/protoc /usr/bin/protoc
3.src/caffe/data_transformer.cpp:2:10: fatal error: opencv2/core/core.hpp: No such file or directory
https://blog.csdn.net/u014587123/article/details/88430503 opencv安装
修改makefile.config中
#INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
#LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib
为
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial /opt/Opencv2/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial /opt/Opencv2/lib
4.src/caffe/layers/hdf5_data_layer.cpp:13:10: fatal error: hdf5.h: No such file or directory
apt-get install libhdf5-serial-dev
5../include/caffe/util/db_leveldb.hpp:7:10: fatal error: leveldb/db.h: No such file or directory
git clone https://github.com/google/leveldb
6../include/caffe/util/db_lmdb.hpp:8:10: fatal error: lmdb.h: No such file or directory
apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
7.nvcc fatal : Unsupported gpu architecture 'compute_20'
Makefile:594: recipe for target '.build_release/cuda/src/caffe/layers/absval_layer.o' failed
在Makefile.config文件中根据自己CUDA的版本注释不同的行。
# CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
# For CUDA >= 9.0, comment the *_20 and *_21 lines for compatibility.
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
8./usr/bin/ld: cannot find -lleveldb
/usr/bin/ld: cannot find -lsnappy
/usr/bin/ld: cannot find -lcblas
/usr/bin/ld: cannot find -latlas
collect2: error: ld returned 1 exit status
apt-get install libleveldb-dev
apt-get install libsnappy-dev
sudo apt-get install libatlas-base-dev
9..build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
在Makefile.config文件中取消注释 OPENCV_VERSION := 3
10.python/caffe/_caffe.cpp:10:10: fatal error: numpy/arrayobject.h: No such file or directory
sudo apt-get install python-numpy
11./usr/bin/ld: cannot find -lpython3.6
将 /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/(libpython3.6.so所在文件夹)添加到Makefile.config文件中
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial /opt/Opencv2/lib /usr/lib/x86_64-linux-gnu /usr/lib/python3.6/config-3.6m-x86_64-linux-gnu/(libpython3.6.so所在文件夹)
12./usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromFormat'
/usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyUnicodeUCS4_FromEncodedObject'
/usr/lib/x86_64-linux-gnu/libboost_python.so: undefined reference to `PyNumber_InPlaceDivide'
cd /usr/lib/x86_64-linux-gnu/
sudo rm libboost_python.so
sudo ln -s libboost_python-py36.so libboost_python.so
https://blog.csdn.net/weixin_38883095/article/details/106138238