Configure Rtools40 for CMDSTAN

My Rtools40 is missing mingw32-make. I tried to run the following check_cmdstan commands check_cmdstan_toolchain(fix = TRUE) and it didn’t work.

I realized it may be due to the computer being company restricted. I could install Rtools and Rstudio in my local user drive. But I can’t seems to run the
check_cmdstan_toolchain(fix = TRUE) in R, which wants to run pacman and install mingw32-make. Is there a quick fix to have the Rtools40 configured manually without having to run this command? Is it possible to, say, download/copy a mingw32-make file from an installed system, and then set the path properly?

check_cmdstan_toolchain()
Error:
RTools installation found but PATH was not properly set.
Run check_cmdstan_toolchain(fix = TRUE) to fix the issue.

check_cmdstan_toolchain(fix = TRUE)
Installing mingw32-make and writing RTools path to ~/.Renviron …
Error in processx::run(“pacman”, args = c(“-Syu”, “mingw-w64-x86_64-make”, :
System command ‘pacman’ failed, exit status: 1, stderr (last 10 lines):
E> error: failed to update mingw32 (download library error)
E> error: failed retrieving file ‘mingw64.db’ from cloud.r-project.org : SSL certificate problem: unable to get local issuer certificate
E> error: failed retrieving file ‘mingw64.db’ from cran.r-project.org : SSL certificate problem: unable to get local issuer certificate
E> error: failed retrieving file ‘mingw64.db’ from r-windows.github.io : SSL certificate problem: unable to get local issuer certificate
E> error: failed to update mingw64 (download library error)
E> error: failed retrieving file ‘ucrt64.db’ from cloud.r-project.org : SSL certificate problem: unable to get local issuer certificate
E> error: failed retrieving file ‘ucrt64.db’ from cran.r-project.org : SSL certificate problem: unable to get local issuer certificate
E> error: failed retrieving file ‘ucrt64.db’ from r-windo

Sys.which(“make”)
make
“C:\Users\zhup3107\DOCUME1\rtools40\rtools40\usr\bin\make.exe”
system(‘mingw32-make -v’)
[1] 127
system(‘g++ -v’)
Using built-in specs.
COLLECT_GCC=C:\Users\zhup3107\DOCUME
1\rtools40\rtools40\mingw64\bin\G__1.EXE
COLLECT_LTO_WRAPPER=C:/Users/zhup3107/DOCUME
1/rtools40/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: …/gcc-8.3.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran --disable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion=‘Built by Jeroen for the R-project’ --with-bugurl=https://github.com/r-windows --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 8.3.0 (Built by Jeroen for the R-project)
[1] 0

1 Like

Installing mingw32-make manually is definitely possible.

First, download the source package from the RTools repo using this link: https://cloud.r-project.org/bin/windows/Rtools/4.0/mingw64/mingw-w64-x86_64-make-4.2.1-2-any.pkg.tar.xz

Then, open up the RTools bash shell:

And run:

pacman -U path/to/mingw-w64-x86_64-make-4.2.1-2-any.pkg.tar.xz

For example, I download the source package to my Downloads folder, so the command for me was:

pacman -U Downloads/mingw-w64-x86_64-make-4.2.1-2-any.pkg.tar.xz

image

I think I have the same problem but for R 4.3.1 and RTools 4.3 on windows. I would like to download packages and install them manually as described for RTools4.0 above, but I have trouble installing the packages, or cannot find the correct package files. I have looked at
https://cloud.r-project.org/bin/windows/Rtools/rtools43/files/
and tried the various toolchain files in there, e.g.,
https://cloud.r-project.org/bin/windows/Rtools/rtools43/files/rtools43-toolchain-libs-full-5550.tar.zst
However, when I try
$ pacman -U “\path\to\rtools43-toolchain-libs-full-5550.tar.zst”
warning: database file for ‘clangarm64’ does not exist (use ‘-Sy’ to download)
warning: database file for ‘mingw32’ does not exist (use ‘-Sy’ to download)
warning: database file for ‘mingw64’ does not exist (use ‘-Sy’ to download)
warning: database file for ‘ucrt64’ does not exist (use ‘-Sy’ to download)
warning: database file for ‘clang32’ does not exist (use ‘-Sy’ to download)
warning: database file for ‘clang64’ does not exist (use ‘-Sy’ to download)
warning: database file for ‘msys’ does not exist (use ‘-Sy’ to download)
loading packages…
error: missing package metadata in \path\to\rtools43-toolchain-libs-full-5550.tar.zst
error: ‘\path\to\rtools43-toolchain-libs-full-5550.tar.zst’: invalid or corrupted package


(pacman -Sy fails with errors like
error: failed retrieving file ‘mingw32.db’ from mirror.iscas.ac.cn : SSL certificate problem: self-signed certificate in certificate chain)