简体   繁体   English

Gfortran错误在本地安装R-devel

[英]Gfortran error installing R-devel locally

I've been going round in circles on the web for several hours now so I've given up and need to ask the pros. 我已经在网上转了几个小时,所以我已经放弃了,需要问专家。

I'm trying to install a newer version of R in a local folder on a Ubuntu server. 我正在尝试在Ubuntu服务器上的本地文件夹中安装R的较新版本。 I need a specific package (Phangorn), but the system wide copy of R is too old, and I can't upgrade it because it will break too many other people's dependencies (and I'm not the admin). 我需要一个特定的程序包(Phangorn),但是R的系统范围的副本太旧了,我无法升级它,因为它会破坏其他人的依赖性(并且我不是管理员)。

So, I downloaded the R-devel latest version and followed these excellent instructions ( http://pj.freefaculty.org/blog/?p=315 ). 因此,我下载了R-devel最新版本,并遵循了这些出色的说明( http://pj.freefaculty.org/blog/?p=315 )。 I had to install my own copies of zlib, liblzma (XZ) and pcre (now in ~/packages ). 我必须安装自己的zlib,liblzma(XZ)和pcre副本(现在在~/packages )。 I didn't need to do curl and bzip2 it seems. 我似乎不需要做curl和bzip2。 This caused enough problems as it is, but after much faffing, I was able to successfully compile R. 这确实引起了很多问题,但是经过多方努力,我才能够成功编译R。

However, when I try to install Phangorn within it, it gives me the following errors: 但是,当我尝试在其中安装Phangorn时,出现以下错误:

/usr/bin/ld: cannot find -lgfortran
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
make: *** [igraph.so] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/home/wms_joe/bin/R-devel/library/igraph’
ERROR: dependency ‘igraph’ is not available for package ‘phangorn’
* removing ‘/home/wms_joe/bin/R-devel/library/phangorn’

The downloaded source packages are in
    ‘/tmp/RtmpahSdck/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning messages:
1: In install.packages("phangorn") :
  installation of package ‘igraph’ had non-zero exit status
2: In install.packages("phangorn") :
  installation of package ‘phangorn’ had non-zero exit status

So from what I can tell Phangorn depends on igraph which depends on gfortran, and R can't find it. 因此,根据我的判断,Phangorn取决于igraph,而后者取决于gfortran,而R找不到它。

It looks to be the same problem as detailed in this thread: Building R package getting error "ld: cannot find -lgfortran " 它看起来与该线程中所述的问题相同: Building R包出现错误“ ld:找不到-lgfortran”

But the solutions all seem to need softlinking and therefore requiring sudo which totally defeats the point of me doing a local install :/ 但是解决方案似乎都需要软链接,因此需要sudo,这完全使我无法进行本地安装:/

What are my options here? 我在这里有什么选择? If I download lgfortran for my own directory (assuming that even fixes the problem) where should I be linking it to? 如果我为自己的目录下载lgfortran(假设它甚至解决了问题),我应该将其链接到哪里?

Those are not 'excellent instructions' as they are for RHEL6, not Ubuntu. 这些不是针对RHEL6(而非Ubuntu)的“优秀说明”。 So you have an impedance mismatch. 因此,您会遇到阻抗不匹配的情况。

On Ubuntu, your fastest bet (if you have src-dep dependencies) is 在Ubuntu上,最快的选择(如果您具有src-dep依赖项)是

sudo apt-get build-dep r-base

The second fastest is to look at the package metadata source to read the Build-Depends from debian/control (but there doesn't seem to be an online copy). 第二快的是查看软件包元数据源,以从debian / control中读取Build-Depends(但似乎没有在线副本)。

As for phanghorn, you could also try to download its source and just edit away the requirement for a particular R version and see what happens -- sometimes this is just for changes with, say, vignettes and will not affect your usability at all. 至于phanghorn,您也可以尝试下载源代码,然后编辑掉对特定R版本的要求,然后看看会发生什么-有时,这仅是用于进行渐晕效果的更改,完全不会影响您的可用性。

Lastly, your build failed because igraph could not be built because gfortran components were missing. 最后,您的构建失败了,因为缺少gfortran组件而无法构建igraph。 Install, if you can, the libgfortran-*-dev package corresponding to your compiler version -- and installing r-base-dev should guarantee it. 如果可以的话,安装与您的编译器版本相对应的libgfortran-*-dev软件包-安装r-base-dev应该可以保证它。

Last but not least, consider something like Docker to run local variants of installed programs. 最后但并非最不重要的一点是,考虑像Docker之类的东西来运行已安装程序的本地变体。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM