2

Having followed the Caffe build instructions, I get the following error

:~/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

I check the install of hdf5: libhdf5-dev with apt-get:

sudo apt-get install libhdf5-dev
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances       
Lecture des informations d'état... Fait
libhdf5-dev est déjà la plus récente version disponible

cuda7 is installed, opencv 3 ...

Seanny123
  • 8,776
  • 13
  • 68
  • 124
Jean-Pat
  • 1,839
  • 4
  • 24
  • 41
  • any chance translating these messages to English, please? – Shai May 28 '15 at 08:27
  • just means that libhdf5-dev is installed ("the earliest version available") – Jean-Pat May 28 '15 at 08:28
  • 1
    do you mean the *latest* available version? – Shai May 28 '15 at 10:35
  • things start going better with: `sudo ln -s /usr/lib/x86_64-linux-gnu/hdf5/serial/hdf5_hl.a /usr/lib/x86_64-linux-gnu/hdf5/hdf5_hl.a` , `sudo ln -s /usr/lib/x86_64-linux-gnu/hdf5/serial/hdf5_hl.so /usr/lib/x86_64-linux-gnu/hdf5/hdf5_hl.so` according to [https://groups.google.com/forum/#!topic/caffe-users/cdyqjNpoFRY] but a problem with /usr/bin/ld persists – Jean-Pat May 30 '15 at 17:06
  • Try `sudo ln -s /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_hl.so /usr/lib/x86_64-linux-gnu/` - I think your symlinks are wrong. – Ibrahim Jul 01 '15 at 23:58
  • @Shai : you're right! – Jean-Pat Oct 11 '15 at 11:24

2 Answers2

3

The steps required to make it build on Ubuntu 15.04 and Debian 8.x can be found in this GitHub issue.

To summarise:

#!/bin/bash
# manipulate header path, before building caffe on debian jessie
# usage:
# 1. cd root of caffe
# 2. bash <this_script>
# 3. build

# transformations :
#  #include "hdf5/serial/hdf5.h" -> #include "hdf5/serial/hdf5.h"
#  #include "hdf5_hl.h" -> #include "hdf5/serial/hdf5_hl.h"

find . -type f -exec sed -i -e 's^"hdf5.h"^"hdf5/serial/hdf5.h"^g' -e 's^"hdf5_hl.h"^"hdf5/serial/hdf5_hl.h"^g' '{}' \;

Followed by

Modify INCLUDE_DIRS in Makefile.config

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

And finally, make some simlinks to HD5

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
Seanny123
  • 8,776
  • 13
  • 68
  • 124
  • 1
    I'm using Ubuntu 15.10. I have to add `LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial` to **Makefile.config** – wannik Dec 02 '15 at 02:57
1

Maybe try installing the entire hdf5 package, not only the dev portion.

If that doesn't work, verify that you have the hdf5.h header on your system and check its path.

You can check gcc's include path with the command [source]

gcc -xc -E -v -
Community
  • 1
  • 1
cfh
  • 4,576
  • 1
  • 24
  • 34
  • A bunch of hdf5 files are installed: hdf5-tools, libhdf5-8, libhdf5-cpp-8, libhdf5-dev,hdf5-helpers, libhdf5-serial-dev – Jean-Pat May 28 '15 at 08:35
  • $ whereis hdf5.h hdf5: /usr/include/hdf5 – Jean-Pat May 28 '15 at 08:41
  • 1
    is `'/usr/include/hdf5'` on your `'INCLUDE_PATH'`? – Shai May 28 '15 at 08:43
  • Modifying data_layers.hpp didn't help: $ 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:39: fatal error: /usr/include/hdf5: Aucun fichier ou dossier de ce type #include "/usr/include/hdf5"//"hdf5.h" – Jean-Pat May 28 '15 at 08:44
  • modifying data_layers.hpp as #include "/usr/include/hdf5" instead of #include "hdf5.h" failed too (same error) – Jean-Pat May 28 '15 at 08:49
  • installing hdf5 from source may be the solution – Jean-Pat May 28 '15 at 09:03
  • echo $INCLUDE_PATH is empty – Jean-Pat May 28 '15 at 10:30
  • #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-linux-gnu/4.9/include /usr/local/include /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. – Jean-Pat May 28 '15 at 11:01