4

I am trying to install the R-pbh-5 package for R, which requires h5r. When I try to install h5r with install_version("h5r", "1.4.7"), I receive the following error:

[...]
checking for library containing inflate... -lz
checking for library containing H5open... no
configure: error: Can't find HDF5
ERROR: configuration failed for package ‘h5r’

I searched the Ubuntu package index for HDF5 and installed the libraries libhdf5-10, libhdf5-dev, hdf5-tools, and pbh5tools. It seems to be correctly installed as well:

$ whereis hdf5
hdf5: /usr/include/hdf5

I just spent the last hours googling, but I can't figure out what I'm missing here. Any advice?

> sessionInfo()
R Under development (unstable) (2018-02-12 r74246)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS

Matrix products: default
BLAS: /opt/R/3.5.0/lib/R/lib/libRblas.so
LAPACK: /opt/R/3.5.0/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.5.0 tools_3.5.0    yaml_2.1.17    Rhdf5lib_1.1.5

Update 1:

Following the suggestions in the comments, I managed to get one step further. When I run:

R CMD INSTALL h5r_1.4.7.tar.gz --configure-vars="LDFLAGS='-L/usr/lib/x86_64-linux-gnu/hdf5/serial/' CPPFLAGS='-I/usr/include/hdf5/serial'"

I now receive the following error:

-I/usr/include/hdf5/serial
-L/usr/lib/x86_64-linux-gnu/hdf5/serial/
checking for library containing inflate... -lz
checking for library containing H5open... -lhdf5
checking for sufficiently new HDF5... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c h5_debug.c -o h5_debug.o
h5_debug.c:4:18: fatal error: hdf5.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:159: recipe for target 'h5_debug.o' failed
make: *** [h5_debug.o] Error 1
ERROR: compilation failed for package ‘h5r’
  • There are some historic issues with Debian (and derivatives) packaging the HDF5 headers / libraries in a serial subdirectory - I wonder if that's the issue here? Perhaps there's a way around it by passing appropriate --configure-vars to the build process? – steeldriver Feb 28 '18 at 15:03
  • I am not so familiar with custom build commands. Could you help me out and formulate the appropriate option which would point to the hdf libs? – bgbrink Feb 28 '18 at 15:08
  • 1
    Unfortunately I'm not either - there's some information here based on which I'd try something like R CMD INSTALL <whatever> --configure-vars='LDFLAGS=-L/usr/lib/x86_64-linux-gnu/hdf5/serial/' – steeldriver Feb 28 '18 at 15:18
  • Did you try sudo apt-get install hdf5-helpers? – N0rbert Feb 28 '18 at 19:25
  • Thank you for your suggestions. Installing hdf5-helpers did not change anything, but @steeldriver was pointing me in the right direction. I updated the question. – bgbrink Mar 1 '18 at 11:31
0

I managed to do it, although in slightly messy way. I used sudo cp -rs /usr/include/hdf5/serial/* /usr/share/R/include to create links to all the hdf5 files within the R/include folder, which is included in the build by default.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.