Caffe无法在ubuntu 15.04上构建

时间:2015-05-28 08:21:32

标签: caffe ubuntu-15.04

关注Caffe build instructions后,我收到以下错误

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

安装了cuda7,opencv 3 ...

2 个答案:

答案 0 :(得分:3)

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

总结:

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

其次是

修改INCLUDE_DIRS

中的Makefile.config
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/

最后,为HD5制作一些simlink

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

答案 1 :(得分:1)

也许尝试安装整个hdf5包,而不仅仅是dev部分。

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

您可以使用命令[source]

检查gcc的包含路径
gcc -xc -E -v -