Hi - I recently got a new Win10 pc and install R etc., but struggled to get RStan running. There seems to be quite a few threads around this, and I’ve tried the suggested methods but to no avail.
(see: Problems getting Stan to run after upgrading to R 4.0.2,
New error: cleanup_makevar(old) : argument “RMU” is missing, with no default Interfaces RStan rstan bug compiler windows
Can’t get stan() to run with R 4.0.2 despite hours of messing with Makevars.win Interfaces RStan
My setup is as follows:
- Windows 10
- Microsoft R Open 4.0.2
- RStudio 1.3.1093
- RStan 2.21.2
- RTools 4
- Checkpoint 0.4.4
After following the instructions and installing RTools 4 per: RTools 4 and R4.0, all the checks returned their supposed values.
I did have a Makevars.win file created with:
dotR <- file.path(Sys.getenv("HOME"), ".R")
if (!file.exists(dotR)) dir.create(dotR)
M <- file.path(dotR, ifelse(.Platform$OS.type == "windows", "Makevars.win", "Makevars"))
if (!file.exists(M)) file.create(M)
cat("CXX14FLAGS += -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2",file = "~/.R/Makevars.win", sep = "\n", append = FALSE)
But when I ran
library(rstan)
options(mc.cores = parallel::detectCores())
rstan_options(auto_write = TRUE)
example(stan_model,run.dontrun = TRUE)
I got the error message:
Error in cleanup_makevar(old) :
argument "RMU" is missing, with no default
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'C:/rtools40/usr/mingw_/bin/g++' not found
As per the other thread, when I deleted the Makevars.win file, the model ran a bit more, but still got stuck in the end with the following:
Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file4b842a773f.o:file4b842a773f.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D1Ev[_ZN3tbb8internal26task_scheduler_observer_v3D1Ev]+0x14): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file4b842a773f.o:file4b842a773f.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1c): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file4b842a773f.o:file4b842a773f.cpp:(.text$_ZN4stan4math16ad_tape_observerD1Ev[_ZN4stan4math16ad_tape_observerD1Ev]+0x15): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/rtools40/mingw
Also tried down-versioning the withr
package to 2.2.0
but the error messages remain the same.
I did notice that Sys.which("g++")
returns
Sys.which(“g++”)
g++
“”
but
Sys.which(“make”)
make
“C:\rtools40\usr\bin\make.exe”
Recreating a Makevars.win
file with the following doesn’t help either
CXX14FLAGS = -O3 -g0 -Wno-ignored-attributes -Wno-deprecated-declarations
CXX14 = C:\rtools40\mingw64\bin\g++ -m$(WIN)
I’ve tried multiple uninstall/reinstall/delete all R folders and .R files but still no luck. I’m pretty stumped at this stage. Would appreciate any help in getting RStan up and running again. Thanks in advance!