./include/caffe/common.hpp:4:32: fatal error: boost/shared_ptr.hpp: 沒有那個文件或目錄
所有類似於上面的錯誤,都可以用如下格式來解決:
解決方案:出現該錯誤的原因是少了依賴。
在命令行輸入:
$ sudo apt-get install --no-install-recommends libboost-all-dev
即可解決。
解決辦法是依據出現錯誤的順序而給出的,為了方便,可以直接先執行所有解決辦法后再安裝caffe。
1. ./include/caffe/common.hpp:5:27: fatal error: gflags/gflags.h: No such file or directory
解決辦法:sudo apt-get install libgflags-dev
2. ./include/caffe/util/mkl_alternate.hpp:14:19: fatal error: cblas.h: No such file or directory
解決辦法:sudo apt-get install libblas-dev
3. ./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory
解決辦法:在Makefile.config找到以下行並添加藍色部分
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-Linux-gnu/hdf5/serial
4. ./include/caffe/util/db_lmdb.hpp:8:18: fatal error: lmdb.h: No such file or directory
解決辦法:sudo apt install liblmdb-dev
5. /usr/bin/ld: cannot find -lcblas
/usr/bin/ld: cannot find -latlas
解決辦法:sudo apt install libatlas-base-dev
6. caffe /usr/bin/ld: 找不到 -lhdf5_hl
打開Makefile,將第181行的:
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hlhdf5
改為:
LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial opencv_core opencv_highgui opencv_imgproc opencv_imgcodecs
這里的改動是為了避免出現hdf5.h錯誤。
7. caffe 找不到hdf5_hl
laiyuanyu http://blog.csdn.net/autocyz/article/details/51783857
//重要的一項
將# Whatever else you find you need goes here.下面的
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
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
//這是因為ubuntu16.04的文件包含位置發生了變化,尤其是需要用到的hdf5的位置,所以需要更改這一路徑
cd /usr/lib/x86_64-linux-gnu
查看某文件的所有軟鏈接:ls -al *libhdf5*
\\然后根據情況執行下面兩句:
sudo ln -s libhdf5_serial.so.10.1.0 libhdf5.so
sudo ln -s libhdf5_serial_hl.so.10.0.2 libhdf5_hl.so
7.
python/caffe/_caffe.cpp:1:52: fatal error: Python.h: No such file or directory
#include <Python.h> // NOLINT(build/include_alpha)
遇到此類問題基本是caffe找不到python,因此在make py之前反復確認下anaconda或python所在目錄是否存在。
因此需要修改。
本人一直遇到的問題就是因為anaconda安裝后 默認的名字為 anaconda2 8.ImportError: /home/meyer/anaconda2/bin/../lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /home/meyer/cz/caffe-master/python/caffe/../../build/lib/libcaffe.so.1.0.0) http://blog.csdn.net/lwgkzl/article/details/77658269