fatal error: hdf5.h: No such file or directory

一颗行走的大白菜

If you get “fatal error: hdf5.h: No such file or directory” while trying to compile Caffe on Linux that can be due to different reasons.

First, you need to make sure the HDF5 packages are installed. If they are not installed, you can install them easily using

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

If it’s installed, then probably you need to provide the path to the compiler.
GCC looks in several different places for headers. On a normal Unix system, if you do not instruct it otherwise, it will look for headers requested with #include in:

/usr/local/include
libdir/gcc/target/version/include
/usr/target/include
/usr/include

You can find out the path of the hdf5.h using

find /usr -iname "*hdf5.h*"

usually you would find something like
/usr/include/hdf5/serial/hdf5.h

then you can just simply type

export CPATH="/usr/include/hdf5/serial/"

Make will be able to find hdf5.h now.
Enjoy.

猜你喜欢

转载自blog.csdn.net/qq_34650787/article/details/80199186