Install hdf5r package in R 4.0.2

Page content

While installing the R package “hdf5r” version 1.3.3, I encountered the error:

fatal error: hdf5.h: No such file or directory
 #include <hdf5.h>
          ^~~~~~~~
compilation terminated.

My OS is Debian buster/10.6, and the package “libhdf5-dev” has been installed. It looks R cannot find the path of hdf5 header and library files.

It has been resolved by:

1. Export environment variables for header files

export C_INCLUDE_PATH=/usr/include/hdf5/serial/:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/include/hdf5/serial/:$CPLUS_INCLUDE_PATH

2. Create symbolic links for library files

cd /usr/lib/x86_64-linux-gnu/
sudo ln -s libhdf5_hl_cpp.so.100.1.2 libhdf5_hl.so.100
sudo ln -s libhdf5_cpp.so.103.0.0  libhdf5.so.103

3. Install package “hdf5r”

install.packages("hdf5r")

Now there would be OK.