0

I've recently upgraded R on my Ubuntu 14.04 to version 3.6, but since then I can't install any package (tried many already, including "ape", "ggplot2", etc). I did the upgrade by removing the previous version of R, and installing the new one following the installation steps for Linux specific to my Ubuntu version (https://www.stats.bris.ac.uk/R/).

The error message I'm getting when installing a package is:

g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o ape.so BIONJ.o NNI.o RcppExports.o SPR.o TBR.o additive.o ape.o bNNI.o bionjs.o bipartition.o bitsplits.o delta_plot.o dist_dna.o dist_nodes.o ewLasso.o heap.o mat_expo.o me.o me_balanced.o me_ols.o mvr.o mvrs.o nj.o njs.o pic.o plot_phylo.o prop_part.o rTrait.o read_dna.o reorder_Rcpp.o reorder_phylo.o treePop.o tree_build.o tree_phylo.o triangMtd.o triangMtds.o ultrametric.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR

/usr/bin/ld: cannot find -lgfortran

collect2: error: ld returned 1 exit status

make: *** [ape.so] Error 1

ERROR: compilation failed for package ‘ape’

*removing ‘/home/myself/R/x86_64-pc-linux-gnu-library/3.6/ape’

Warning in install.packages :

   installation of package ‘ape’ had non-zero exit status

The downloaded source packages are in

‘/tmp/Rtmpd0FQfs/downloaded_packages’

I noticed that the error "/usr/bin/ld: cannot find -lgfortran" is common to all packages I'm trying to install, and I don't know what it means. In the case of "ggplot2", for example, the error is:

FY_SOURCE=2 -g  -c tprs.c -o tprs.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o mgcv.so coxph.o discrete.o gdi.o init.o magic.o mat.o matrix.o mgcv.o misc.o mvn.o qp.o soap.o sparse-smooth.o tprs.o -llapack -lblas -lgfortran -lm -lquadmath -fopenmp -L/usr/lib/R/lib -lR

/usr/bin/ld: cannot find -lgfortran

collect2: error: ld returned 1 exit status

make: *** [mgcv.so] Error 1

ERROR: compilation failed for package ‘mgcv’

*removing ‘/home/myself/R/x86_64-pc-linux-gnu-library/3.6/mgcv’

Warning in install.packages :

  installation of package ‘mgcv’ had non-zero exit status

ERROR: dependency ‘mgcv’ is not available for package ‘ggplot2’

*removing ‘/home/myself/R/x86_64-pc-linux-gnu-library/3.6/ggplot2’

Warning in install.packages :

  installation of package ‘ggplot2’ had non-zero exit status


The downloaded source packages are in

‘/tmp/Rtmpd0FQfs/downloaded_packages’

Anyone would have an idea of how to solve it? That would be very much appreciated.

rvbarreto
  • 683
  • 9
  • 24
matheusb
  • 43
  • 5
  • Does this answer your question? [Building R package and error "ld: cannot find -lgfortran"](https://stackoverflow.com/questions/6302209/building-r-package-and-error-ld-cannot-find-lgfortran) – rvbarreto Jan 29 '20 at 15:31
  • Perfect! Thanks a lot. The solution that worked for me was: `sudo ln -s /usr/lib/x86_64-linux-gnu/libgfortran.so.3 /usr/lib/libgfortran.so` and `sudo ln -s /usr/lib/x86_64-linux-gnu/libquadmath.so.0 /usr/lib/libquadmath.so` – matheusb Jan 30 '20 at 09:18

0 Answers0