Caffe didn't see hdf5.h when compiling

kelvin picture kelvin · May 3, 2016 · Viewed 27.9k times · Source

I am having trouble when installing Caffe Deep Learning Framework on Python:

When I run make command at caffe directory, it says

hdf5.h:no such directory

The steps I have done:

I will be grateful if someone can help me.

Error message:

CXX src/caffe/util/hdf5.cpp
in file include from src/caffe/util/hdf5.cpp:1:0:
./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory
compilation terminated 

Makefile:572 recipe for target '.build_release/src/caffe/util/hdf5.o'       
failed Make:*** [.build_release/src/caffe/util/hdf5.o] Error 1

Answer

alfakini picture alfakini · May 5, 2016

What is the version of your Ubuntu install? Try this. In your Makefile.config try to append /usr/include/hdf5/serial/ to INCLUDE_DIRS:

--- INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
+++ INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/

and rename hdf5_hl and hdf5 to hdf5_serial_hl and hdf5_serial in the Makefile:

--- 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

More about the bug fix here.