无法在 AWS 实例上安装 hexbin 库 R

无法在 AWS 实例上安装 hexbin 库 R

我正在开发一个使用 R 中的 plotly 包的项目。当我尝试安装 plotly 时,hexbin(依赖项)无法编译,因为它找不到 gfortran .so 库。我已经安装了 gfortran(gcc64-gfortran.x86_64),但 .so 文件未安装或无法被发现ld。以下是日志的相关部分:

$ R
> install.packages("hexbin", repos = "http://cran.rstudio.com/")
Installing package into ‘/home/ec2-user/R/x86_64-redhat-linux-gnu-library/3.4’

...

gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -o hexbin.so hbin.o hcell.o herode.o hsm.o reg.o -lgfortran -lm -lquadmath - L/usr/lib64/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
/usr/bin/ld: cannot find -lquadmath
collect2: error: ld returned 1 exit status

跑步ld -lgfortran --verbose给了我这个:

...

==================================================
attempt to open /usr/x86_64-amazon-linux/lib64/libgfortran.so failed
attempt to open /usr/x86_64-amazon-linux/lib64/libgfortran.a failed
attempt to open /usr/lib64/libgfortran.so failed
attempt to open /usr/lib64/libgfortran.a failed
attempt to open /usr/local/lib64/libgfortran.so failed
attempt to open /usr/local/lib64/libgfortran.a failed
attempt to open /lib64/libgfortran.so failed
attempt to open /lib64/libgfortran.a failed
attempt to open /usr/x86_64-amazon-linux/lib/libgfortran.so failed
attempt to open /usr/x86_64-amazon-linux/lib/libgfortran.a failed
attempt to open /usr/local/lib/libgfortran.so failed
attempt to open /usr/local/lib/libgfortran.a failed
attempt to open /lib/libgfortran.so failed
attempt to open /lib/libgfortran.a failed
attempt to open /usr/lib/libgfortran.so failed 
attempt to open /usr/lib/libgfortran.a failed
ld: cannot find -lgfortran

yum info gcc64-gfortran.x86_64说我安装的 gfortran 是 amzn-main 的 6.4.1 版本。

答案1

我在使用标准 AWS Linux 实例时遇到了同样的问题。
我必须将两者链接起来,gfortran然后quadmath

sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libgfortran.so /usr/lib/libgfortran.so
sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libquadmath.so /usr/lib/libquadmath.so

答案2

我找到了问题所在。当我搜索 .so fortran 文件时,我find错误地使用了命令。我使用的是find / -file gfortran.so而不是find / -file *gfortran*。我只是用 链接了它sudo ln -s /usr/lib/gcc/x86_64-amazon-linux/6.4.1/libgfortran.so /usr/lib/libgfortran.so,现在链接已经解决了。

相关内容