caffe编译问题-src/caffe/net.cpp:8:18: fatal error: hdf5.h: No such file or directory compilation terminated.

错误描述

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编译问题

2.caffe编译hdf5问题

猜你喜欢

转载自www.cnblogs.com/happyamyhope/p/9205038.html