Caffe无法在ubuntu 15.04上构建



按照Caffe构建指令执行后,我得到了以下错误

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

我用apt-get:

检查hdf5: libhdf5-dev的安装
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

在Ubuntu 15.04和Debian 8上构建所需的步骤。x可以在GitHub issue中找到

总结:

#!/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' '{}' ;

紧随其后

修改Makefile.config中的INCLUDE_DIRS

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

最后,制作一些HD5的simlinks

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

也许可以尝试安装整个hdf5包,而不仅仅是开发部分。

如果这不起作用,请检查系统上是否有hdf5.h头文件,并检查其路径。

你可以用命令[source]

检查gcc的include路径
gcc -xc -E -v -

最新更新