R 包 h5r 配置:错误:找不到 HDF5

R 包 h5r 配置:错误:找不到 HDF5

我正在尝试安装R-PBH-5R 包,需要h5r。当我尝试使用 安装时h5rinstall_version("h5r", "1.4.7")收到以下错误:

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

我在 Ubuntu 软件包索引中搜索了 HDF5 ,并安装了库libhdf5-10、、和。它似乎也安装正确:libhdf5-devhdf5-toolspbh5tools

$ whereis hdf5
hdf5: /usr/include/hdf5

我花了几个小时在谷歌上搜索,但我不知道我错过了什么。有什么建议吗?

> 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

更新 1:

根据评论中的建议,我设法更进一步。当我运行时:

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/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’

答案1

我设法做到了,尽管有点混乱。我曾经sudo cp -rs /usr/include/hdf5/serial/* /usr/share/R/include创建指向文件夹中所有 hdf5 文件的链接R/include,默认情况下该文件夹包含在构建中。

相关内容