Updating packages doesn't recognize Rtools 4.0

Hi! I have a problem here. When I try to update the packages: this message appears:

install.packages(c("class", "foreign", "KernSmooth", "MASS", "nnet", "spatial"), lib="C:/R/R-4.0.0/library")

  There are binary versions available but the source versions are later:
             binary   source needs_compilation
class        7.3-16   7.3-17              TRUE
foreign      0.8-76   0.8-79              TRUE
KernSmooth  2.23-16  2.23-17              TRUE
MASS       7.3-51.5 7.3-51.6              TRUE
nnet         7.3-13   7.3-14              TRUE
spatial      7.3-11   7.3-12              TRUE

installing the source packages ‘class’, ‘foreign’, ‘KernSmooth’, ‘MASS’, ‘nnet’, ‘spatial’

probando la URL 'https://cran.rstudio.com/src/contrib/class_7.3-17.tar.gz'
Content type 'application/x-gzip' length 20748 bytes (20 KB)
downloaded 20 KB

probando la URL 'https://cran.rstudio.com/src/contrib/foreign_0.8-79.tar.gz'
Content type 'application/x-gzip' length 362619 bytes (354 KB)
downloaded 354 KB

probando la URL 'https://cran.rstudio.com/src/contrib/KernSmooth_2.23-17.tar.gz'
Content type 'application/x-gzip' length 25348 bytes (24 KB)
downloaded 24 KB

probando la URL 'https://cran.rstudio.com/src/contrib/MASS_7.3-51.6.tar.gz'
Content type 'application/x-gzip' length 494134 bytes (482 KB)
downloaded 482 KB

probando la URL 'https://cran.rstudio.com/src/contrib/nnet_7.3-14.tar.gz'
Content type 'application/x-gzip' length 29128 bytes (28 KB)
downloaded 28 KB

probando la URL 'https://cran.rstudio.com/src/contrib/spatial_7.3-12.tar.gz'
Content type 'application/x-gzip' length 44612 bytes (43 KB)
downloaded 43 KB

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

*** arch - i386
C:/Rtools/mingw_32/bin/gcc  -I"C:/R/R-40~1.0/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c R_systat.c -o R_systat.o
sh: C:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/R/R-40~1.0/etc/i386/Makeconf:222: R_systat.o] Error 127
ERROR: compilation failed for package 'foreign'
* removing 'C:/R/R-4.0.0/library/foreign'
* restoring previous 'C:/R/R-4.0.0/library/foreign'
Warning in install.packages :
  installation of package ‘foreign’ had non-zero exit status
* installing *source* package 'KernSmooth' ...
** package 'KernSmooth' successfully unpacked and MD5 sums checked
** using staged installation
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/gfortran  -fno-optimize-sibling-calls    -O2  -mfpmath=sse -msse2 -mstackrealign -c blkest.f -o blkest.o
make: C:/Rtools/mingw_32/bin/gfortran: Command not found
make: *** [C:/R/R-40~1.0/etc/i386/Makeconf:246: blkest.o] Error 127
ERROR: compilation failed for package 'KernSmooth'
* removing 'C:/R/R-4.0.0/library/KernSmooth'
* restoring previous 'C:/R/R-4.0.0/library/KernSmooth'
Warning in install.packages :
  installation of package ‘KernSmooth’ had non-zero exit status
* installing *source* package 'MASS' ...
** package 'MASS' successfully unpacked and MD5 sums checked
** using staged installation
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/gcc  -I"C:/R/R-40~1.0/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c MASS.c -o MASS.o
sh: C:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/R/R-40~1.0/etc/i386/Makeconf:222: MASS.o] Error 127
ERROR: compilation failed for package 'MASS'
* removing 'C:/R/R-4.0.0/library/MASS'
* restoring previous 'C:/R/R-4.0.0/library/MASS'
Warning in install.packages :
  installation of package ‘MASS’ had non-zero exit status
* installing *source* package 'nnet' ...
** package 'nnet' successfully unpacked and MD5 sums checked
** using staged installation
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/gcc  -I"C:/R/R-40~1.0/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c nnet.c -o nnet.o
sh: C:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/R/R-40~1.0/etc/i386/Makeconf:222: nnet.o] Error 127
ERROR: compilation failed for package 'nnet'
* removing 'C:/R/R-4.0.0/library/nnet'
* restoring previous 'C:/R/R-4.0.0/library/nnet'
Warning in install.packages :
  installation of package ‘nnet’ had non-zero exit status
* installing *source* package 'spatial' ...
** package 'spatial' successfully unpacked and MD5 sums checked
** using staged installation
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/gcc  -I"C:/R/R-40~1.0/include" -DNDEBUG          -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init.c -o init.o
sh: C:/Rtools/mingw_32/bin/gcc: No such file or directory
make: *** [C:/R/R-40~1.0/etc/i386/Makeconf:222: init.o] Error 127
ERROR: compilation failed for package 'spatial'
* removing 'C:/R/R-4.0.0/library/spatial'
* restoring previous 'C:/R/R-4.0.0/library/spatial'
Warning in install.packages :
  installation of package ‘spatial’ had non-zero exit status
* installing *source* package 'class' ...
** package 'class' successfully unpacked and MD5 sums checked
** using staged installation
** libs

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

However, the packages don't update and still appearing the update tab. Reading the message, It looks like they don't recognize the Tool 4.0 path. (C:\rtools40)
Is there something that I can do about?
Regards

Follow oficial instructions to add RTools 4.0 to your PATH

writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")

https://cran.r-project.org/bin/windows/Rtools/

Hi! thanks for your answer. My path is "C:\rtools40". Where I have to put it in the command suggested?.
I tried to replace both "RTOOLS40_HOME" and "PATH" and the error still appears.
Regards

PS This, as the official instruction suggests, appears in both cases

> Sys.which("make")
                              make 
"C:\\rtools40\\usr\\bin\\make.exe" 
1 Like

After installing rtools40, i have the same issue

Looking at the directory of the rtools40 installation, it appears that a subdirectory is named mingw32 instead of mingw_32 as seems expected by the compiler...
Renaming the directory with this change allows the process to go further in the source installation but finally abort with a new error message:

../bin/x64/R.dll: file not recognized: file format not recognized

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.