grimbough / rhdf5

Package providing an interface between HDF5 and R
http://bioconductor.org/packages/rhdf5
61 stars 22 forks source link

installation error #146

Open DawnEve opened 3 months ago

DawnEve commented 3 months ago

When I try to install this package like this, an error occures: BiocManager::install("rhdf5")

g++ -std=gnu++11 -shared -L/opt/R/4.3.2/lib64/R/lib -L/usr/local/lib64 -o rhdf5.so H5.o H5A.o H5D.o H5E.o H5F.o H5G.o H5I.o H5L.o H5O.o H5P.o H5R.o H5S.o H5S_extras.o H5T.o H5T_extras.o H5Z.o H5constants.o HandleList.o HandleListWrap.o bit64conversion.o external_filters.o h5dump.o h5ls.o h5testLock.o h5writeDataFrame.o printdatatype.o utils.o wrap.o WARNING: ignoring environment value of R_HOME /picb/jinlab/wangjl/R/x86_64-pc-linux-gnu-library/4.3/Rhdf5lib/lib/libhdf5.a -L/picb/jinlab/wangjl/R/x86_64-pc-linux-gnu-library/4.3/Rhdf5lib/lib -lcrypto -lcurl -lsz -laec -lz -ldl -lm -L/opt/R/4.3.2/lib64/R/lib -lR
/bin/ld: cannot find WARNING:: No such file or directory
/bin/ld: cannot find ignoring: No such file or directory
/bin/ld: cannot find environment: No such file or directory
/bin/ld: cannot find value: No such file or directory
/bin/ld: cannot find of: No such file or directory
/bin/ld: cannot find R_HOME: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [rhdf5.so] Error 1
ERROR: compilation failed for package ‘rhdf5’
* removing ‘/picb/jinlab/wangjl/R/x86_64-pc-linux-gnu-library/4.3/rhdf5’

My environment is CentOS7.9, R 4.3.2, Rsudio.

> packageVersion("Seurat")
[1] ‘4.4.0’
> packageVersion("Rhdf5lib")
[1] ‘1.24.1’

> system("which h5cc")
/home/wangjl/.local/bin/h5cc

> system("gcc --version")
gcc (GCC) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
DawnEve commented 3 months ago

I find the answer today, though I don't know why this works:

1. check the path of HDF5:
$ which h5cc
~/.local/bin/h5cc

2. Run under R in shell:
export HDF5_DIR=/home/wangjl/.local/
export LD_LIBRARY_PATH=$HDF5_DIR/lib:$LD_LIBRARY_PATH
export CFLAGS="-I$HDF5_DIR/include"
export LDFLAGS="-L$HDF5_DIR/lib"

Rscript -e 'if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager"); BiocManager::install("rhdf5")'

3. check in shell R or Rstudio:
R
> library("rhdf5")
> packageVersion("rhdf5") #‘2.46.1’