Hi everyone,
I’m trying to install Stan on Windows 10, R-4.0.2, Rtools 4.0. I’ve followed the installation instructions but when I compile a model I’m receiving theses errors:
Compilation argument:
C:/PROGRA~1/R/R-40~1.2/bin/x64/R CMD SHLIB fileba061084f37.cpp 2> fileba061084f37.cpp.err.txt
C:/Rtools/mingw_64/bin/g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -I"C:/Program Files/R/R-4.0.2/library/Rcpp/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppEigen/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppEigen/include/unsupported" -I"C:/Program Files/R/R-4.0.2/library/BH/include" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/src/" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppParallel/include/" -I"C:/Program Files/R/R-4.0.2/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include "C:/Program Files/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp" -std=c++1y -include C:/Program Files/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I "C:/Program Files/R/R-4.0.2/library/StanHeaders/include" -I "C:/Program Files/R/R-4.0.2/library/RcppEigen/include" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c fileba061084f37.cpp -o fileba061084f37.o
sh: C:/Rtools/mingw_64/bin/g++: No such file or directory
make: *** [C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:229: fileba061084f37.o] Error 127
Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'C:/rtools40/usr/mingw_/bin/g++' not found
2: In file(con, "r") :
cannot open file 'fileba061084f37.cpp.err.txt': No such file or directory
I’ve read for hours and hours all the issues and potential solutions about it and nothing fixed it. I’ve reinstalled Rtools many times, reinstalled rstan many times, no way to fix the errors. I’ve also set the following paths to my environment but without success:
PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"
BINPREF="C:/Rtools/mingw_$(WIN)/bin/"
Further, I’ve fixed set the makevars.win as follows:
CXX14FLAGS=-O3 -mtune=native
CXX11FLAGS=-O3 -mtune=native
Finally when I run Sys.getenv(“PATH”), I get:
[1] "C:\\rtools40\\usr\\bin;C:\\Program Files\\R\\R-4.0.2\\bin\\x64;C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0;C:\\Windows\\System32\\OpenSSH;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Intel\\WiFi\\bin;C:\\Program Files\\Common Files\\Intel\\WirelessCommon;C:\\Program Files\\qpdf-10.0.1\\bin;C:\\Program Files\\nodejs;C:\\Program Files (x86)\\Yarn\\bin;C:\\ProgramData\\chocolatey\\bin;C:\\Users\\Administrateur\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\JetBrains\\PyCharm 2019.3.4\\bin;C:\\Users\\Administrateur\\AppData\\Roaming\\TinyTeX\\bin\\win32;C:\\rtools40\\mingw64\\bin"
When I run version I get:
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 4
minor 0.2
year 2020
month 06
day 22
svn rev 78730
language R
version.string R version 4.0.2 (2020-06-22)
nickname Taking Off Again
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252
[2] LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
other attached packages:
[1] rstan_2.21.2 ggplot2_3.3.2
[3] StanHeaders_2.21.0-5
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 compiler_4.0.2 pillar_1.4.6
[4] prettyunits_1.1.1 tools_4.0.2 pkgbuild_1.1.0
[7] jsonlite_1.7.0 lifecycle_0.2.0 tibble_3.0.2
[10] gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.7
[13] cli_2.0.2 rstudioapi_0.11 curl_4.3
[16] yaml_2.2.1 parallel_4.0.2 loo_2.3.0
[19] gridExtra_2.3 dplyr_1.0.0 withr_2.2.0
[22] generics_0.0.2 vctrs_0.3.1 tidyselect_1.1.0
[25] stats4_4.0.2 grid_4.0.2 glue_1.4.1
[28] inline_0.3.15 R6_2.4.1 processx_3.4.3
[31] fansi_0.4.1 purrr_0.3.4 callr_3.4.3
[34] magrittr_1.5 codetools_0.2-16 matrixStats_0.56.0
[37] scales_1.1.1 ps_1.3.3 ellipsis_0.3.1
[40] assertthat_0.2.1 colorspace_1.4-1 V8_3.2.0
[43] RcppParallel_5.0.2 munsell_0.5.0 crayon_1.3.4
Thank you in advance for your help :)