This is a list of the current RStan Windows problems and known temporary workarounds:
- Error includes something about prim/mat/fun/Eigen.hpp
If your error is similar to
g++.exe: error: Files/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:
No such file or directory
or anything that mentions stan/math/prim/mat/fun/Eigen.hpp
UPDATE (24.8.2020):
This issue was fixed in the latest version of StanHeaders (2.21.0-6), so make sure you have the latest version of the StanHeaders package.
- Error include /bin/x64/R CMD SHLIB something.cpp 2>
If your error is similar to
In system(cmd, intern = !verbose) :
running command
‘C:/PROGRA~1/R/R-40~1.2/bin/x64/R CMD SHLIB file2968734e19d4.cpp 2>
file2968734e19d4.cpp.err.txt’ had status 1
This is an issue with the inline package. Current workaround is to install it with
remotes::install_github("bgoodri/inline")
- Error include something about `mingw32/bin/ld.exe:
If you see an error containing something like mingw32/bin/ld.exe: cannot find Files: No such file or directory
, for example
C:/Program Files (x86)/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find C:/Program: No such file or directory
C:/Program Files (x86)/rtools40/mingw32/bin/../lib/gcc/i686-w64-mingw32/8.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find Files: No such file or directory
This is because you have installed RTools in a location that contains spaces (most likely C:/Program Files/RTools/...
)
I believe this is an issue with R in general, as I am unable to install any package (non-rstan related) from source with RTools installed in a location with spaces.
- You experience frequent R session crashes
This is very likely an issue with compile flags. In this case, open the Makevars.win
file.
If you do not know where your Makevars.win
is located, run
file.path(Sys.getenv("HOME"), ".R", "Makevars.win")
open the file and remove any mention of march=native from the file.
Also double check the Renviron file that can be found at
file.path(Sys.getenv("HOME"), ".R", ".Renviron")
- Warning about mingw_/bin/g++ not found
If a warning similar to below is printed:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found
You can safely ignore this. This will go away in the next bugfix release. Your models work fine even if you see these warnings.
Other advice in case of other problems not listed above:
- if you are using R4.x, run
Sys.getenv("PATH")
. It should start with"C:\rtools40\usr\bin;"
. If it does not, run
writeLines('PATH="${RTOOLS40_HOME}\\usr\\bin;${PATH}"', con = "~/.Renviron")
and restart R/Rstudio.
@everyone Feel free to edit the post if there are other known workarounds for known issues or any of the workarounds have better options.