Hi,
I’m having some trouble getting the R toolchain to work on a Windows 10 PC. I found several threads on these forums (and elsewhere through Google) but didn’t find the piece of information that solves the problem. Apologies in advance for asking help with something that isn’t really an RStan problem, but after a day of failed Googling I hope someone can point out what I’m missing.
Right now I have R 3.6.2, RStudio 1.2.5033, and Rtools 3.5.0.4 - this is installed in C:\Rtools\
Here is some output on session information and diagnostics:
> Sys.getenv(“BINPREF”)
[1] “C:/Rtools/mingw_$(WIN)/bin/”
> writeLines(strsplit(Sys.getenv(“PATH”), “;”)[[1]])
C:\Rtools\bin
C:\Rtools\mingw_64\bin
C:\Program Files\R\R-3.6.2\bin
C:\Program Files\R\R-3.6.2\bin\x64
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0
C:\WINDOWS\System32\OpenSSH
C:\Program Files\Common Files\ThinPrint
C:\Program Files (x86)\Enterprise Vault\EVClient
C:\Program Files\Git\cmd
C:\Program Files\MATLAB\R2018b\runtime\win64
C:\Program Files\MATLAB\R2018b\bin
C:\Users\maum\AppData\Local\Microsoft\WindowsApps
C:\blp\DAPI
C:\blp\DAPI\DDE
> system(“g++ -v”)
[1] 127
> pkgbuild::has_rtools(debug=TRUE)
Scanning R CMD config CC…
cc_path:
‘’ does not exist
Scanning path…
ls: C:\Rtools\bin\ls.exe
gcc_path: C:\Rtools\mingw_64\bin\gcc.exe
VERSION.txt
Rtools version 3.5.0.4
Version: 3.5
Found compatible gcc on path
[1] TRUE
> pkgbuild::has_build_tools(debug=TRUE)
[1] FALSE
In addition, the above asks me if I want to install Rtools again - I declined because it’s already installed (and I don’t have admin rights on this PC so it wouldn’t work anyway).
> writeLines(readLines(“J:\Documents\.R\Makevars.win”))
CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=corei7 -mtune=corei7
> devtools::session_info(“rstan”)
-Session info --------------------------------------------------------------------------------------------------------
setting value
version R version 3.6.2 (2019-12-12)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz Europe/Berlin
date 2020-01-21
-Packages ------------------------------------------------------------------------------------------------------------
(…)
[1] \pggm-intra.intern/mijnmappen/MAUM/Documents/R/win-library/3.6
[2] C:/Program Files/R/R-3.6.2/library
> Rcpp::evalCpp(“1 + 1”, showOutput = TRUE)
C:/PROGRA~1/R/R-36~1.2/bin/x64/R CMD SHLIB -o “sourceCpp_3.dll” “” “file272435fc4990.cpp”
Warning message:
In system(cmd) :
‘CreateProcess’ failed to run ‘C:\Rtools\bin\make.exe -f “C:/PROGRA~1/R/R-36~1.2/etc/x64/Makeconf” -f “C:/PROGRA~1/R/R-36~1.2/share/make/winshlib.mk” -f “//pggm-intra.intern/mijnmappen/maum/Documents/.R/Makevars.win” SHLIB_LDFLAGS=’$(SHLIB_CXXLDFLAGS)’ SHLIB_LD=‘$(SHLIB_CXXLD)’ SHLIB=“sourceCpp_3.dll” WIN=64 TCLBIN=64 OBJECTS=“file272435fc4990.o”’
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, :
Error 1 occurred building shared library.
So to my limited knowledge it seems that the computer can find Rtools (from pkgbuild::has_rtools()
) but for some reason seems unable to use it.
Please let me know if you require any more information or if there’s anything I should try. Thanks a lot for your help!