5

Hello Caffe is a library for deeplearning. When trying to build that library under Ubuntu 15.04, the compilation fails with the message:

:~/App/caffe$ make all

PROTOC src/caffe/proto/caffe.proto
CXX .build_release/src/caffe/proto/caffe.pb.cc
CXX src/caffe/layer_factory.cpp
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: Aucun fichier ou dossier de ce type
 #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

The building failure seems to be Ubuntu specific. I have checked the different dependencies. I tried different workaround: writing the path of hdf5.h directly in the Makefile.config, building hdf5 from source...

Thanks for advices

karel
  • 110,292
  • 102
  • 269
  • 299
Jean-Pat
  • 151
  • 1
  • 1
  • 5
  • Please [edit] you question to actually contain the entire question, thanks. – Seth Jun 01 '15 at 02:38
  • 1
    For those seeking an answer to this problem, the parallel discussion on the Caffe mailing list has solutions: https://groups.google.com/forum/#!topic/caffe-users/cdyqjNpoFRY – Ibrahim Jul 01 '15 at 23:46

1 Answers1

26

install libhdf5-dev

add patch to libhdf5 in Makefile.config.

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

  • +1 Found this searching and it fixed the issue. @Jean-Pat, please consider accepting this answer if it solved your problem. – David Etler Jul 11 '15 at 13:54
  • 1
    This fixes the missing include but the compile just fails later because it can't find the libs. – Alistair Buxton Jul 19 '15 at 11:33
  • @Alistair Buxton: I have made an addition to the answer, in order to show how to fix this issue, if it persists, even after updating the Makefile.config. – Codetoffel Oct 02 '16 at 08:37
  • To me, this leads to another error: `AR -o .build_release/lib/libcaffe.a 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 ` – skyuuka Aug 23 '18 at 22:17
  • This change in the `Makefile.config` fixed my issue: `LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial` – skyuuka Aug 23 '18 at 22:29