Rstan compilation failure

I am trying to install rstan with R 4.0 on windows 10, and can’t get stan to compile models. My error message seems to be related to tbb, but I can’t really make heads or tails of it.
rstan version is 2.21.2, StanHeaders is 2.21.0-7
I’ve attached the full output from calling example(stan_model, package = "rstan", run.dontrun = TRUE) but I think the meat of the error is undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)

My makevars file is set to CXX14FLAGS=-O3 -mtune=native -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 CXX11FLAGS=-O3 -mtune=native -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2
rstan_example_log.txt (37.0 KB)

@andrjohns will surely be able to give some advice :) I’m on OS X unfortunately.

1 Like

Can you try to upgrade the RcppParallel package?


If that does not help maybe the development version of Rcppparallel:

remotes::install_github("RcppCore/RcppParallel@develop", force = TRUE)
1 Like

Hi Dan,

I can see from the logs that you’re using Microsoft’s R Open. Unfortunately there are compatibility issues with rstan and the RcppParallel package with R Open on Windows which haven’t been ironed out. If upgrading or using the development version of RcppParallel does not solve your issue, then I’d recommend trying out cmdstanR: Getting started with CmdStanR • cmdstanr, since it’s known working with R Open


That makes sense, thanks for the info! I can confirm CmdStanR works just fine.

1 Like