Contents

1 Motivation

Rhdf5lib provides the C and C++ HDF5 libraries. It is primarily useful to developers of other R packages who want to make use of the capabilities of the HDF5 library directly in the C or C++ code of their own packages, rather than using a higher level interface such as the rhdf5 package. Using Rhdf5lib make life easier for users, as they do not have to worry about installing libraries at a system level, and for developers since they can work with a defined version of the library rather than developing strategies to cope with the potential for multiple versions.

Rhdf5lib is very much inspired by the zlibbioc and Rhtslib packages.*

2 Usage

There is an example package, usingRhdf5lib, that demonstrates how packages should link to Rhdf5lib.

2.2 Locating the library headers

In order for the C/C++ compiler to find the HDF5 headers during package installation, add Rhdf5lib to the LinkingTo field of the DESCRIPTION file of your package, e.g.

LinkingTo: Rhdf5lib

In you C or C++ code files, you can then use the standard include techniques, e.g., #include "hdf5.h" or #include "H5Cpp.h". You can inspect the header files manually to check their names and declared functions. To find their location on your system you can use the following code:

system.file(package="Rhdf5lib", "include")
## [1] "/tmp/RtmpXvRGZn/Rinst39b81bce66ba/Rhdf5lib/include"

3 Non-standard ZLIB location

Rhdf5lib requires the ZLIB compression library to be installed on non-Windows platforms. If installation fails due with a message reporting that zlib.h can not be found, it is possible to provide the appropriate path explicitly during installation via the configure.args argument e.g. 

BiocManager::install('Rhdf5lib', configure.args = "--with-zlib='/path/to/zlib/'")

Here /path/to/zlib should be the directory that contains both include/zlib.h and lib/libz.a. For example, on a typical Ubuntu installation this may be /usr/ while for libraries installed via miniconda this location could be /home/<USER>/miniconda3/.

4 Funding

MLS was supported by the BMBF-funded Heidelberg Center for Human Bioinformatics (HD-HuB) within the German Network for Bioinformatics Infrastructure (de.NBI), Förderkennzeichen #031A537B

Session info

## R version 4.0.3 (2020-10-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 18.04.5 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.12-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.12-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] BiocStyle_2.18.1
## 
## loaded via a namespace (and not attached):
##  [1] BiocManager_1.30.10 compiler_4.0.3      magrittr_2.0.1     
##  [4] bookdown_0.21       htmltools_0.5.1.1   tools_4.0.3        
##  [7] yaml_2.2.1          stringi_1.5.3       rmarkdown_2.6      
## [10] knitr_1.30          stringr_1.4.0       digest_0.6.27      
## [13] xfun_0.20           rlang_0.4.10        evaluate_0.14