在R发布了3.6.1之后,我在我的CentOS服务器上编译了这个版本的R语言,随后就是开始安装各种R包。在安装clusterProfiler
时,其中的一个R包igraph
安装出现了如下报错
Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/opt/sysoft/R-3.6.1/lib64/R/library/00LOCK-igraph/00new/igraph/libs/igraph.so':
libgfortran.so.4: cannot open shared object file: No such file or directory
根据我多年的debug经验,推测出应该是gfortran
这个工具没有安装好, 我检索了/usr/lib64
下的动态库,发现果然没有
ls /usr/lib64/ | grep fortran
gfortran
libgfortran.so.1
libgfortran.so.1.0.0
libgfortran.so.3
libgfortran.so.3.0.0
libhdf5_fortran.so.8
libhdf5_fortran.so.8.0.1
libhdf5hl_fortran.so.8
libhdf5hl_fortran.so.8.0.1
于是用yum search gfortran
搜索是不是能够直接用YUM安装
compat-libgfortran-41-debuginfo.x86_64 : Debug information for package compat-libgfortran-41
compat-gcc-44-gfortran.x86_64 : Fortran support for compatibility compiler
compat-libgfortran-41.x86_64 : Compatibility Fortran 95 runtime library version 4.1.2
compat-libgfortran-41.i686 : Compatibility Fortran 95 runtime library version 4.1.2
gcc-gfortran.x86_64 : Fortran support
libgfortran.x86_64 : Fortran runtime
libgfortran.i686 : Fortran runtime
libgfortran-static.i686 : Static Fortran libraries
libgfortran-static.x86_64 : Static Fortran libraries
libgfortran4.i686 : Fortran runtime v4
libgfortran4.x86_64 : Fortran runtime v4
libgfortran5.i686 : Fortran runtime v5
libgfortran5.x86_64 : Fortran runtime v5
mingw32-gcc-gfortran.x86_64 : MinGW Windows cross-compiler for FORTRAN for the win32 target
mingw64-gcc-gfortran.x86_64 : MinGW Windows cross-compiler for FORTRAN for the win64 target
使用yum install libgfortran4
安装即可,之后便能找到该动态库
ls /usr/lib64/ | grep fortran
gfortran
libgfortran.so.1
libgfortran.so.1.0.0
libgfortran.so.3
libgfortran.so.3.0.0
libgfortran.so.4
libgfortran.so.4.0.0
libhdf5_fortran.so.8
libhdf5_fortran.so.8.0.1
libhdf5hl_fortran.so.8
libhdf5hl_fortran.so.8.0.1
后续就能顺利安装了
假如你没有root权限,那么可以参考下面两篇进行解决