DIGITS: can't find hdf5.h when build caffe

I want to install digits on my debian jessie.
When I build caffe(NVIDIA's fork), I got errors complaining that hdf5.h could not be found.

I’m sure I had installed libhdf5-serial-dev and libhdf5-dev, and I found the header file in /usr/include/hdf5/serial and its libs in /usr/lib/x86_64-linux-gnu.

So, what’s wrong? Some one help me?

The build error message show below:

(venv)➜  caffe  make all --jobs=4
CXX src/caffe/layer_factory.cpp
CXX src/caffe/util/insert_splits.cpp
CXX src/caffe/util/db.cpp
CXX src/caffe/util/upgrade_proto.cpp
In file included from src/caffe/util/upgrade_proto.cpp:10:0:
./include/caffe/util/io.hpp:8:18: fatal error: hdf5.h: no such file or directory
 #include "hdf5.h"
                  ^
compilation terminated.
Makefile:512: recipe for target '.build_release/src/caffe/util/upgrade_proto.o' failed
make: *** [.build_release/src/caffe/util/upgrade_proto.o] Error 1
make: *** 正在等待未完成的任务....
In file included from ./include/caffe/common_layers.hpp:10:0,
                 from ./include/caffe/vision_layers.hpp:10,
                 from src/caffe/layer_factory.cpp:6:
./include/caffe/data_layers.hpp:9:18: fatal error: hdf5.h: no such file or directory
 #include "hdf5.h"
                  ^
compilation terminated.
Makefile:512: recipe for target '.build_release/src/caffe/layer_factory.o' failed
make: *** [.build_release/src/caffe/layer_factory.o] Error 1

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 14
  • Comments: 26

Commits related to this issue

Most upvoted comments

after do the two steps @tangshi mentioned, I continued to add the following lines in MakeFile.config INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/ and LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial/

Lucky! I solved the second problem!

The lib names of hdf5 on debian have a postfix “serial”, therefore -lhdf5 and -lhdf5_hl cannot be found.

To solve it, I created two symbolics:

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

It did not work for me on Ubuntu16.04 LTS.

So I had to

sudo apt-get install libhdf5-10
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-cpp-11
find /usr -iname "*hdf5.h*"
/usr/include/hdf5/serial/hdf5.h
export CPATH="/usr/include/hdf5/serial/"

the lbhdf5 you actually have will determine what symlink to do - so after ls /usr/lib/x86_64-linux-gnu to see what version you have, do the symlink taking that into account. (.e.g i had v10 not v8 as in post above)

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

I solved the header file problem according to here.

But there is another problem:

/usr/bin/ld: cannot find -lhdf5_hl
/usr/bin/ld: cannot find -lhdf5

so sad…

ubuntu 16.04 diff --git a/Makefile b/Makefile index 65d08f7…6c6c9f3 100644 — a/Makefile +++ b/Makefile @@ -178,7 +178,8 @@ ifneq ($(CPU_ONLY), 1) LIBRARIES := cudart cublas curand endif

-LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5 +LIBRARIES += glog gflags protobuf boost_system boost_filesystem m +LIBRARIES += hdf5_serial hdf5_serial_hl

export CPATH=“/usr/include/hdf5/serial/”

Thanks @loretoparisi this worked for me!

It did not work for me on Ubuntu16.04 LTS.

So I had to

sudo apt-get install libhdf5-10
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-cpp-11
find /usr -iname "*hdf5.h*"
/usr/include/hdf5/serial/hdf5.h
export CPATH="/usr/include/hdf5/serial/"

Thank you! This worked for me

Worked on ubuntu 18.04, thanks

Note - I had to change:

sudo ln -s libhdf5_serial.so.8.0.2 libhdf5.so
sudo ln -s libhdf5_serial_hl.so.8.0.2 libhdf5_hl.so

to

sudo ln -s libhdf5_serial.so.100.0.0 libhdf5.so
sudo ln -s libhdf5_serial.so.100.0.1 libhdf5_hl.so

install opencv: apt-get install libopencv-dev

And had to remove the following lines from the makefile since I am on cuda 9.0:

-gencode arch=compute_20,code=sm_20
-gencode arch=compute_20,code=sm_21

Thanks a lot… worked in Ubuntu 16…