构建 R 包和错误“ld:找不到 -lgfortran" [英] Building R package and error "ld: cannot find -lgfortran"

查看:29
本文介绍了构建 R 包和错误“ld:找不到 -lgfortran"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 lars 包.Ubuntu 11.04 整洁 64 位.从建筑我得到:

<块引用>

* 安装 *source* 包 'lars' ...** 库gfortran -fpic -O3 -pipe -g -c delcol.f -o delcol.ogcc -shared -o lars.so delcol.o -lgfortran -lm -L/usr/lib64/R/lib -lR/usr/bin/ld: 找不到 -lgfortrancollect2: ld 返回 1 个退出状态制作:*** [lars.so] 错误 1错误:包lars"编译失败

gfortran 已安装,当我运行 gfortran --version 我得到

<块引用>

gfortran --version GNU Fortran(Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

sudo ldconfig -v 给出错误

<块引用>

/sbin/ldconfig.real: 无法统计/usr/lib/libgfortran.so: 没有那个文件或目录

我已经删除并重新安装了 gfortran.我需要什么来解决这个问题?

解决方案

对于 Debian/Ubuntu 家族,我们通常推荐

 $ sudo apt-get install r-base-dev

因为它包含了编译通常需要的所有包.这种方法一直在测试,因为自动化包构建器依赖于此(以及额外的每个包构建依赖).gfortran 包也在此处列出;也许您之前安装的链接断开了,所以我也尝试 dpkg --purge gfortran;apt-get install gfortran.也就是说,数十个 R 包(以及 R 本身)使用 Fortran,所以这里不应该有任何魔法.

I'm trying to install the package lars. Ubuntu 11.04 Natty 64-bit. From building I get:

* installing *source* package âlarsâ ...
** libs
gfortran   -fpic  -O3 -pipe  -g -c delcol.f -o delcol.o
gcc -shared -o lars.so delcol.o -lgfortran -lm -L/usr/lib64/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: ld returned 1 exit status
make: *** [lars.so] Error 1
ERROR: compilation failed for package âlarsâ

gfortran is installed and when I run gfortran --version I get

gfortran --version GNU Fortran (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2

sudo ldconfig -v gives the error

/sbin/ldconfig.real: Cannot stat /usr/lib/libgfortran.so: No such file or directory

I have already removed and reinstalled gfortran. What do I need to fix this?

解决方案

For the Debian / Ubuntu family, we usually recommend

 $ sudo apt-get install r-base-dev

as it pulls in all packages commonly needed for compiling. And this approach gets tested all the time as the automated package builders rely on this (as well as additional per-package Build-Depends). The gfortran package is listed here too; maybe you have a broken link from a prior installation so I'd also try dpkg --purge gfortran; apt-get install gfortran. That said, dozens of R packages (and R itself) use Fortran so there should not be any magic here.

这篇关于构建 R 包和错误“ld:找不到 -lgfortran"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆