简体   繁体   中英

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. 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).

So, I downloaded the R-devel latest version and followed these excellent instructions ( http://pj.freefaculty.org/blog/?p=315 ). I had to install my own copies of zlib, liblzma (XZ) and pcre (now in ~/packages ). I didn't need to do curl and bzip2 it seems. This caused enough problems as it is, but after much faffing, I was able to successfully compile R.

However, when I try to install Phangorn within it, it gives me the following errors:

/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.

It looks to be the same problem as detailed in this thread: Building R package getting error "ld: cannot find -lgfortran "

But the solutions all seem to need softlinking and therefore requiring sudo which totally defeats the point of me doing a local install :/

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?

Those are not 'excellent instructions' as they are for RHEL6, not Ubuntu. So you have an impedance mismatch.

On Ubuntu, your fastest bet (if you have src-dep dependencies) is

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).

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.

Lastly, your build failed because igraph could not be built because gfortran components were missing. Install, if you can, the libgfortran-*-dev package corresponding to your compiler version -- and installing r-base-dev should guarantee it.

Last but not least, consider something like Docker to run local variants of installed programs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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