0

I'm trying to install rtools40 according to the instructions at https://cran.rstudio.com/bin/windows/Rtools/. I've already set up the PATH, but when it comes for installing an R package from Source:

install.packages("jsonlite", type = "source")

It gives this error:

install.packages("jsonlite", type = "source")
probando la URL 'https://cran.rstudio.com/src/contrib/jsonlite_1.7.0.tar.gz'
Content type 'application/x-gzip' length 1057524 bytes (1.0 MB)
downloaded 1.0 MB

* installing *source* package 'jsonlite' ...
** package 'jsonlite' successfully unpacked and MD5 sums checked
** using staged installation
** libs

*** arch - i386
"C:/rtools40/usr/bin/mingw32/bin/"gcc  -I"C:/R-40~1.2/include" -DNDEBUG -Iyajl/api       -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
sh: C:/rtools40/usr/bin/mingw32/bin/gcc: No such file or directory
make: *** [C:/R-40~1.2/etc/i386/Makeconf:222: base64.o] Error 127
ERROR: compilation failed for package 'jsonlite'
* removing 'C:/R-4.0.2/library/jsonlite'
* restoring previous 'C:/R-4.0.2/library/jsonlite'
Warning in install.packages :
  installation of package ‘jsonlite’ had non-zero exit status

The downloaded source packages are in
    ‘C:\Users\Mauro\AppData\Local\Temp\RtmpqcxD9B\downloaded_packages’

I add the PATH routes that are currently active:

enter image description here

Phil
  • 7,287
  • 3
  • 36
  • 66
  • 1
    Does this happen with other packages you install from source? Could be an issue specific to that package. – Phil Aug 24 '20 at 06:05
  • 1
    Is there a reason you are building from source rather than just installing the CRAN binary version? The latter would be a lot easier. Does `file.exists("C:/rtools40/usr/bin/mingw32/bin/gcc")` return TRUE? What version of RStudio are you using? Are you sure you have a [32-bit Windows OS](https://support.microsoft.com/en-ie/office/determine-whether-your-computer-is-running-a-32-bit-version-or-64-bit-version-of-the-windows-operating-system-aac162a1-0cb3-46f2-888f-2f22897396ce). What does `Sys.getenv("R_ARCH")` return? Seeing "i386" makes me think 32 bit – MrFlick Aug 24 '20 at 06:36
  • Please show a screenshot/printout of your PATHs. Have you restarted R after installing Rtools? – Roman Luštrik Aug 24 '20 at 06:36
  • @MrFlick I'm following the install instructions in the webpage, to be sure that everything works well. `file.exists("C:/rtools40/usr/bin/mingw32/bin/gcc")` returns FALSE. The Rstudio version is 1.3.959. I checked and it is indeed 64 bits Windows. `Sys.getenv("R_ARCH")` returns "/x64". – Mauro Rojas Aug 24 '20 at 17:04
  • @RomanLuštrik I did restart R, and when trying to find "make" by means of `Sys.which("make")` it returns **"C:\\rtools40\\usr\\bin\\make.exe"**. – Mauro Rojas Aug 24 '20 at 17:11
  • @Phil I was also trying to install (update) Bioconductor and it gives this error: _C:/rtools40/usr/bin/mingw32/bin/gcc: No such file or directory make: *** [C:/R-40~1.2/etc/i386/Makeconf:222: dotsElt.o] Error 127 ERROR: compilation failed for package 'backports'_ (...) _Warning message: In install.packages(update[instlib == l, "Package"], l, repos = repos, : installation of package ‘backports’ had non-zero exit status_ – Mauro Rojas Aug 24 '20 at 17:17
  • Are you sure you doanloaded and ran the "rtools40-x86_64.exe" file? Did you edit any "Makeconf" or "Makevars" files? Does `file.exists("C:/rtools40/mingw64/bin/gcc.exe")` return true? – MrFlick Aug 24 '20 at 18:22
  • @MrFlick Yes, I downloaded rtools40-x86_64.exe. I haven't done modifications to the mentioned files. `file.exists("C:/rtools40/mingw64/bin/gcc.exe")` returns TRUE. What could be the problem? I just downloaded from bioconductor curatedOvarianData package and it runs well, actually that's what I need. But I still don't understand why there's this problem. – Mauro Rojas Aug 24 '20 at 19:31
  • Does `file.exists("~/.R/Makevars")` return TRUE? It seems what you are experiencing may be related to this question: https://stackoverflow.com/questions/49895448/r-is-using-the-mingw-32-to-compile-packages-for-64-bit-architecture Have you had R installed on your machine before? What does `sessionInfo()$platform` return? – MrFlick Aug 24 '20 at 19:43
  • @MrFlick yes, I have R 4.0.1 installed among with Rstudio. `file.exists("~/.R/Makevars")` returns _FALSE_, and `sessionInfo()$platform` returns _"x86_64-w64-mingw32/x64 (64-bit)"_ – Mauro Rojas Aug 25 '20 at 01:55
  • Looks to me like you're running R in 32 bit mode (`C:/R-40~1.2/etc/i386/Makeconf:222`). Run it in 64 bit mode and try again. – Roman Luštrik Aug 26 '20 at 12:46

2 Answers2

0

I'm a beginner at R, but I found this answer on another forum.

Choose a different CRAN repository, RStudios repository is a good choice (http://cran.rstudio.com/ ) or you could choose one that is geographically closer to you.

enter image description here

Disable secure download setting.

enter image description here

Check if your internet connection has traffic restrictions of some kind, like a firewall, proxy server, etc. This is usually the case when you are at work or school.

Sinval
  • 1,315
  • 1
  • 16
  • 25
0

1 No such file or directory, when you this mistake, you can just add "C:/rtools40/usr/bin/mingw32/bin/gcc" to your path(environmental variable

2 Also try to run Rstudio as administrator in a windows laptor