ubuntu16.04 安装caffe 编译错误 cannot find -lhdf5_hl的一种情况

按照《深度学习与计算机视觉》一书221页

make pycaffe -j 命令后出现

LD -o .build_release/lib/libcaffe.so.1.0.0
/usr/bin/ld: cannot find -lhdf5_hl
/usr/bin/ld: cannot find -lhdf5
collect2: error: ld returned 1 exit status
Makefile:572: recipe for target '.build_release/lib/libcaffe.so.1.0.0' failed

make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1


解决方法:

$sudo find / -name *lhdf5*

查找到

/usr/include/hdf5
/usr/include/hdf5/serial/hdf5_hl.h
/usr/include/hdf5/serial/hdf5.h
/usr/include/hdf5/serial/hdf5.mod
/usr/local/include/opencv2/flann/hdf5.h
/usr/lib/i386-linux-gnu/libhdf5_serial.settings
/usr/lib/i386-linux-gnu/libhdf5_hl_cpp.so

...

/usr/lib/i386-linux-gnu/hdf5
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5hl_fortran.so
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5_hl_cpp.so
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5_cpp.a
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5_cpp.so
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5hl_fortran.a
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5_hl.so
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5.a
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5.settings
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5_fortran.so
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5_hl_cpp.a
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5_hl.a
/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5_fortran.a

在Makefile.config中改动一下语句:

INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/i386-linux-gnu/hdf5/serial





你可能感兴趣的:(caffe安装,ubuntu16.04)