1

I am repeatedly encountering the following error

/usr/bin/ld: cannot find -lgfortran

when trying to install a lot of r-packages (e.g. igraph, ergm, blockmodels, and I guess every package that requires gcc and fortran in some way or another)

I run R on Ubuntu Trusty, and I have recently upgraded R from 3.1.0 to 3.3.1. When on 3.1.0, I had been able to install igraph and ergm (and others) without any problem, but not blockmodels.

I have checked for the presence of libgfortran on my system: it is there. Actually there is more than one version of it (3, 4.7, 4.8) and also libgfortran-dev is installed (multiple versions as well)

Any idea of what is going on? Thank you for any advice.

Matthew Schuchard
  • 25,172
  • 3
  • 47
  • 67
deltasun
  • 314
  • 3
  • 11
  • Perhaps this will help? http://stackoverflow.com/questions/6302209/building-r-package-getting-error-ld-cannot-find-lgfortran – J_F Sep 07 '16 at 11:03
  • 1
    thanks! i found there a way to fix it. I'll put it on the body of the question – deltasun Sep 07 '16 at 12:41
  • 3
    Do NOT put the answer in your question! Write an actual answer yourself, and after a short mandatory waiting period, click the check mark. – joran Sep 07 '16 at 12:49
  • 1
    The forced `sudo ln -s ...` indicates that something is foul on your system. You should not need it. There are _thousands_ of us running the prebuilt (and always current) R on Ubuntu via the CRAN mirror. Not to mention thousands of automated Travis CI runs on trusty (and older ones on precise). Install R-for-Ubuntu-from-CRAN, and you won't need any ugly gymnastics potentially creating worse longer term problems on your box. – Dirk Eddelbuettel Sep 07 '16 at 13:04
  • 1
    @joran: maybe, but not in this case as it really is not a good answer. – Dirk Eddelbuettel Sep 07 '16 at 13:06
  • @DirkEddelbuettel I see what you mean. But I have exactly done what you say: install R for Ubuntu from CRAN. I also tried to purge it and install it back, but the problem remained. I would really like to have a 'cleaner' way to fix the problem, the point is that i have not found it – deltasun Sep 08 '16 at 12:14
  • Do you have the `r-base-dev` package installed? It is meant to pull in all required dependencies. – Dirk Eddelbuettel Sep 08 '16 at 12:15
  • yes, I have it. I tried to remove and install that as well... – deltasun Sep 08 '16 at 12:18
  • Then go down the line. Looks at `gcc --version` and make sure have the same verson of the Fortran compiler installed. This is _still the wrong place for this discussion_. – Dirk Eddelbuettel Sep 08 '16 at 12:22

1 Answers1

1

In Arch Linux, the gfortran package is named gcc-fortran. To install it:

sudo pacman -S gcc-fortran
Musebe Ivan
  • 160
  • 7