錯誤描述
src/caffe/net.cpp:8:18: fatal error: hdf5.h: No such file or directory compilation terminated. Makefile:583: recipe for target '.build_release/src/caffe/net.o' failed make: *** [.build_release/src/caffe/net.o] Error 1
操作過程
step1:
在Makefile.config文件更改INCLUDE_DIRS和LIBRARY_DIRS的內容,添加/usr/include/hdf5/serial/ 到 INCLUDE_DIRS,也就是把下面第一行代碼改為第二行代碼。
#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
step2:
在Makefile文件的LIBRARIES,把 hdf5_hl 和hdf5修改為hdf5_serial_hl 和 hdf5_serial,也就是把下面第一行代碼改為第二行代碼。
#LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
注意:如果按照上述步驟改過之后仍然出現同樣的錯誤,那可能是hdf5的路徑不匹配,需要locate尋找hdf5的路徑,然后更改為所在系統的安裝路徑。
這個錯誤表明,我們的hdf5.h這個頭文件的路徑沒有被找到,如果你沒有安裝HDF5這個文件 ,那當然是找不到的。再者,就然你安裝了這個文件也可能找不到,那么我們怎么辦。我們用locate hdf5.h找到你安裝的路徑,然后在makefile.conf文件中相應指定就好了。
參考
1.caffe編譯問題;
完