0

When I try to install the package, the following message appears:

Installing 'gmm' ...
Installing package into ‘/home/lucas/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
tentando a URL 'https://cloud.r-project.org/src/contrib/gmm_1.7.tar.gz'
Content type 'application/x-gzip' length 1062903 bytes (1.0 MB)
==================================================
downloaded 1.0 MB

gfortran -fno-optimize-sibling-calls  -fpic  -g -O2 -ffile-prefix-map=/build/r-base-LhKvHL/r-base-4.2.3=. -fstack-protector-strong  -c lambda_met.f -o lambda_met.o
* installing *source* package ‘gmm’ ...
** package ‘gmm’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
/bin/bash: linha 1: gfortran: comando não encontrado
make: *** [/usr/lib/R/etc/Makeconf:192: lambda_met.o] Erro 127
ERROR: compilation failed for package ‘gmm’
* removing ‘/home/lucas/R/x86_64-pc-linux-gnu-library/4.2/gmm’

The downloaded source packages are in
    ‘/tmp/RtmpInFEOy/downloaded_packages’


✔ Package 'gmm' successfully installed.
Warning message:
In utils::install.packages("gmm", repos = "https://cloud.r-project.org") :
  installation of package ‘gmm’ had non-zero exit status

I suppose the problem is related to this part "(as ‘lib’ is unspecified)" so i started the terminal and installed libconfig, but it still didn't work.

Thanks!

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • Welcome to StackOverflow, and look more closely at the error message (now that @MrFlick kindly edited it). To compile you need compilers -- here also a Fortran one. – Dirk Eddelbuettel Mar 24 '23 at 20:56
  • Now, if I may, consider [r2u](https://eddelbuettel.github.io/r2u/) which gives you `gmm` -- as well as 20,000 other CRAN packages -- as binaries for Ubuntu with full and reliable resolution of dependencies. Give it a whirl! – Dirk Eddelbuettel Mar 24 '23 at 20:57

1 Answers1

1

As mentioned in my comment above, you can use binary packages on Ubuntu 22.04. The documentation at the r2u site has the few simple steps to add the relevant apt repository, there is also a script. And to test drive, or for other deployments, we have docker.

Below is a little recording with peek on a quick installation of gmm onto the Docker container: it takes six seconds, and brings the two dependencies in.

enter image description here

That said, the package likely also install from source if you sudo apt install gfortran. In fact, the r-base-dev package has a dependency on it and would already have pulled it in.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Glad to hear. Did you install `gfortran`? Or did you use r2u? Also, if I may, if the answer helped please free to "upvote" it (click on the up triangle) and "accept it" (click on the tickmark you see as you asked the question). This is how StackOverflow lets karma flow. (And I forget which but some things you cannot yet do with your karma of 1. But accepting an answer also gives you points.) – Dirk Eddelbuettel Mar 26 '23 at 00:25