Caffe: Does anyone compile on ubuntu and have to change the #include location of hdf5.h?

Created on 4 Oct 2016  Â·  5Comments  Â·  Source: BVLC/caffe

I cloned caffe a few months ago and conpile it for medical image analysis. But I had to change all the occurrences of #include "hdf5.h" or #include "hdf5_hl.h" in the source code to #include "hdf5/serial/hdf5.h" or #include "hdf5/serial/hdf5_hl.h". And then

  • sudo ln -s /usr/lib/x86_64-linux-gnu/libhdf5_serial_hl.so /usr/lib/x86_64-linux-gnu/libhdf5_hl.so
  • sudo ln -s /usr/lib/x86_64-linux-gnu/libhdf5_serial.so /usr/lib/x86_64-linux-gnu/libhdf5.so

so that I can compile successfuly.
Yesterday I got the latest commit from Github and recompiled it on a brand new Ubuntu 16.04 system. But there is still this issue.

Since caffe works fine, I'm just wondering is it because I installed hdf5 wrongly? or something?
I follow the instructions from here, caffe tutorials.

Most helpful comment

modify Makefile.config as follow:
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/

All 5 comments

I run into similar issues. I try to link *.so as you mentioned above. But it doesn't work for my case. I got same error as follows,

CXX src/caffe/util/hdf5.cpp
In file included from src/caffe/util/hdf5.cpp:1:0:
./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory
#include "hdf5.h"
^
compilation terminated.
Makefile:575: recipe for target '.build_release/src/caffe/util/hdf5.o' failed
make: *** [.build_release/src/caffe/util/hdf5.o] Error 1

Use CMake. It detects the new location automatically.
(plug for https://github.com/BVLC/caffe/issues/3351)

Hi @hortonwu, Did you change the #include "hdf5.h" to #include "hdf5/serial/hdf5.h and the same for hdf_hl.h. The output says the it cannot find hdf5.h, which was the same for me before I modified the location.

modify Makefile.config as follow:
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/

thanks, @guker I did installed successfully!

Was this page helpful?
0 / 5 - 0 ratings