构建pycaffe时无法找到hdf5库

Unable to find hdf5 libraries when building pycaffe

当运行

make pycaffe

我们最终缺少 hdf5 个库。

CXX/LD -o python/caffe/_caffe.so python/caffe/_caffe.cpp
/usr/bin/ld: cannot find -lhdf5_hl
/usr/bin/ld: cannot find -lhdf5
collect2: error: ld returned 1 exit status
Makefile:502: recipe for target 'python/caffe/_caffe.so' failed
make: *** [python/caffe/_caffe.so] Error 1

请注意,这些库的所有可能组合都已安装在此 ubuntu 15.10 系统上。

$ dpkg --get-selections | grep hdf5
hdf5-helpers                    install
libhdf5-10:amd64                install
libhdf5-cpp-10:amd64                install
libhdf5-dev                 install
libhdf5-mpi-dev                 install
libhdf5-mpich-10:amd64              install
libhdf5-mpich-dev               install
libhdf5-openmpi-10:amd64            install
libhdf5-openmpi-dev             install
libhdf5-serial-dev              install

现在我意识到这太过分了..但是一次添加了一个 - 然后我们在添加另一个之前重试了 make pycaffe..我们只是想确定 missing hdf5 libs 不是核心问题。

更新 回应@jon

提供的答案
 dpkg -L libhdf5-dev | grep so
/usr/lib/x86_64-linux-gnu/libhdf5_cpp.so
/usr/lib/x86_64-linux-gnu/libhdf5_serial.so
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl.so
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_fortran.so
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl_cpp.so
/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5hl_fortran.so
/usr/lib/x86_64-linux-gnu/libhdf5_hl_cpp.so
/usr/lib/x86_64-linux-gnu/libhdf5_serial_fortran.so
/usr/lib/x86_64-linux-gnu/libhdf5_serial_hl.so
/usr/lib/x86_64-linux-gnu/libhdf5_serialhl_fortran.so

并且在 Makefile.config:

LIBRARY_DIRS := /usr/opt/libsr $(PYTHON_LIB) 
   /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu

运行 dpkg -L libhdf5-dev | grep so 应该输出:

/usr/lib/x86_64-linux-gnu/libhdf5_hl.so
/usr/lib/x86_64-linux-gnu/libhdf5hl_fortran.so
/usr/lib/x86_64-linux-gnu/libhdf5_fortran.so
/usr/lib/x86_64-linux-gnu/libhdf5_hl_cpp.so
/usr/lib/x86_64-linux-gnu/libhdf5_cpp.so
/usr/lib/x86_64-linux-gnu/libhdf5.so

确保路径 /usr/lib/x86_64-linux-gnu(包含 libhdf5.solibhdf5_hl.so)在 Makefile.configLIBRARY_DIRS