Reputation: 99
I am trying to install an R package, See the code below:
> install.packages("mnormt")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/mnormt_1.5-5.tar.gz'
Content type 'application/x-gzip' length 37169 bytes (36 KB)
==================================================
downloaded 36 KB
* installing *source* package ‘mnormt’ ...
** package ‘mnormt’ successfully unpacked and MD5 sums checked
** libs
gfortran -fpic -g -O2 -fstack-protector-strong -c biv-nt.f -o biv-nt.o
gfortran -fpic -g -O2 -fstack-protector-strong -c sadmvnt.f -o sadmvnt.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o mnormt.so biv-nt.o sadmvnt.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'mnormt.so' failed
make: *** [mnormt.so] Error 1
ERROR: compilation failed for package ‘mnormt’
* removing ‘/usr/local/lib/R/site-library/mnormt’
The downloaded source packages are in
‘/tmp/RtmpQnOaAx/downloaded_packages’
Warning message:
In install.packages("mnormt") :
installation of package ‘mnormt’ had non-zero exit status
But I have already installed gfortran library. Still this error
Upvotes: 4
Views: 3008
Reputation: 26843
My suspicion is that you have installed libgfortran3
but not libgfortran-5-dev
. The latter is required for building things using the library. The best solution in that case would be
sudo apt-get install r-base-dev
This will install libgfortran-5-dev
and any other packages that are strictly necessary for building CRAN packages.
Alternatively you could also use
sudo apt-get install r-cran-mnormt
and skip the binary installation.
Upvotes: 5