Error in compileCode(f, code, language = language, verbose = verbose) : Compilation ERROR, function(s)/method(s) not created! Again

Does it also say which allocated procedure it cannot find?

Yes, exactly.

For example, does it say "cannot find foo" where foo is the name of a function?

No, it does not specifically mention the name of the function.
It indeed only says that “It cannot find the allocated procedure”. That’s all.

Can you try

Sys.setenv(LANG = "en")
install.packages(
"https://win-builder.r-project.org/8bPDZPDG0522/rstan_2.21.2.zip",
repos = NULL, type = "win.binary")

so that it will hopefully emit an error message in English?

Error: package or namespace load failed for ‘rstan’ in inDL(x, as.logical(local), as.logical(now), …):
unable to load shared object ‘C:/Users/Ihn-Whi Heo/Documents/R/win-library/3.6/rstan/libs/x64/rstan.dll’:
LoadLibrary failure: 지정된 프로시저를 찾을 수 없습니다.
In addition: Warning message:
package ‘rstan’ was built under R version 4.0.2

No… error message is still not in English.
지정된 프로시저를 찾을 수 없습니다 still means (in direct translation) cannot find the allocated procedure

@bgoodri
Just in case, please note that my StanHeaders version is StanHeaders_2.21.0-5, and R version is 3.6.3. (OS is in Windows)

Ah, possibly the problem is that you have R 3.6.3 but “package ‘rstan’ was built under R version 4.0.2”. I will make a temporary rstan for R 3.6.3 now.

Ah… I appreciate it! Please let me know if you are done. I will try it right away.
Also, let me know if I have to remove some packages before that, and if that is the case, is there any special code?

@bgoodri
Hello, may I ask if a temporary rstan for R 3.6.3 is built?
Hope this will not bother your schedule. Thank you.

I have a similar issue when running:
example(stan_model, package = "rstan", run.dontrun = TRUE)

Session info:

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=Japanese_Japan.932           
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    
system code page: 1252

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] rstan_2.21.1         StanHeaders_2.21.0-6 loo_2.3.0           
 [4] bayesplot_1.7.2      zoo_1.8-8            extrafont_0.17      
 [7] gtable_0.3.0         forcats_0.5.0        openxlsx_4.1.5      
[10] lubridate_1.7.9      data.table_1.12.8    MASS_7.3-51.6       
[13] readxl_1.3.1         gridExtra_2.3        stringr_1.4.0       
[16] purrr_0.3.4          ggplot2_3.3.2        tidyr_1.1.0         
[19] magrittr_1.5         dplyr_1.0.0         

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6       lattice_0.20-41    prettyunits_1.1.1  ps_1.3.3          
 [5] V8_3.2.0           assertthat_0.2.1   digest_0.6.25      IRdisplay_0.7.0   
 [9] R6_2.4.1           cellranger_1.1.0   plyr_1.8.6         repr_1.1.0        
[13] ggridges_0.5.2     backports_1.1.7    stats4_4.0.2       evaluate_0.14     
[17] pillar_1.4.4       rlang_0.4.6        curl_4.3           uuid_0.1-4        
[21] extrafontdb_1.0    callr_3.4.3        checkmate_2.0.0    munsell_0.5.0     
[25] compiler_4.0.2     pkgconfig_2.0.3    base64enc_0.1-3    pkgbuild_1.0.8    
[29] htmltools_0.5.0    tidyselect_1.1.0   tibble_3.0.1       codetools_0.2-16  
[33] matrixStats_0.56.0 fansi_0.4.1        crayon_1.3.4       withr_2.2.0       
[37] jsonlite_1.6.1     Rttf2pt1_1.3.8     lifecycle_0.2.0    scales_1.1.1      
[41] RcppParallel_5.0.2 zip_2.0.4          cli_2.0.2          stringi_1.4.6     
[45] ellipsis_0.3.1     generics_0.0.2     vctrs_0.3.0        IRkernel_1.1      
[49] tools_4.0.2        glue_1.4.1         processx_3.4.2     parallel_4.0.2    
[53] inline_0.3.15      colorspace_1.4-1   pbdZMQ_0.3-3 

The package install link (below) from previous posts is broken, so I could not try it. 
install.packages(
"https://win-builder.r-project.org/8bPDZPDG0522/rstan_2.21.2.zip",
repos = NULL, type = "win.binary") is broken so I couldn't try it.

When I run the example I get:

stn_md> stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'

stn_md> mod <- stan_model(model_code = stancode, verbose = TRUE)

TRANSLATING MODEL '73fc79f8b1915e8208c736914c86d1a1' FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model '73fc79f8b1915e8208c736914c86d1a1'.
OS: x86_64, mingw32; rstan: 2.21.1; Rcpp: 1.0.4.6; inline: 0.3.15 
 >> setting environment variables: 
PKG_LIBS =  C:/Users/nlinton/Documents/R/win-library/4.0/rstan/lib/x64/libStanServices.a -L"C:/Users/nlinton/Documents/R/win-library/4.0/StanHeaders/libs/x64" -lStanHeaders -L"C:/Users/nlinton/Documents/R/win-library/4.0/RcppParallel/lib/x64" -ltbb
PKG_CPPFLAGS =   -I"C:/Users/nlinton/Documents/R/win-library/4.0/Rcpp/include/"  -I"C:/Users/nlinton/Documents/R/win-library/4.0/RcppEigen/include/"  -I"C:/Users/nlinton/Documents/R/win-library/4.0/RcppEigen/include/unsupported"  -I"C:/Users/nlinton/Documents/R/win-library/4.0/BH/include" -I"C:/Users/nlinton/Documents/R/win-library/4.0/StanHeaders/include/src/"  -I"C:/Users/nlinton/Documents/R/win-library/4.0/StanHeaders/include/"  -I"C:/Users/nlinton/Documents/R/win-library/4.0/RcppParallel/include/"  -I"C:/Users/nlinton/Documents/R/win-library/4.0/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include "C:/Users/nlinton/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp"  -std=c++1y
 >> Program source :

   1 : 
   2 : // includes from the plugin
   3 : // [[Rcpp::plugins(cpp14)]]
   4 : 
   5 : 
   6 : // user includes
   7 : #include <Rcpp.h>
   8 : #include <rstan/io/rlist_ref_var_context.hpp>
   9 : #include <rstan/io/r_ostream.hpp>
  10 : #include <rstan/stan_args.hpp>
  11 : #include <boost/integer/integer_log2.hpp>
  12 : // Code generated by Stan version 2.21.0
  13 : 
  14 : #include <stan/model/model_header.hpp>
  15 : 
  16 : namespace model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1_namespace {
  17 : 
  18 : using std::istream;
  19 : using std::string;
  20 : using std::stringstream;
  21 : using std::vector;
  22 : using stan::io::dump;
  23 : using stan::math::lgamma;
  24 : using stan::model::prob_grad;
  25 : using namespace stan::math;
  26 : 
  27 : static int current_statement_begin__;
  28 : 
  29 : stan::io::program_reader prog_reader__() {
  30 :     stan::io::program_reader reader;
  31 :     reader.add_event(0, 0, "start", "model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1");
  32 :     reader.add_event(3, 1, "end", "model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1");
  33 :     return reader;
  34 : }
  35 : 
  36 : class model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1
  37 :   : public stan::model::model_base_crtp<model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1> {
  38 : private:
  39 :         double y_mean;
  40 : public:
  41 :     model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1(rstan::io::rlist_ref_var_context& context__,
  42 :         std::ostream* pstream__ = 0)
  43 :         : model_base_crtp(0) {
  44 :         ctor_body(context__, 0, pstream__);
  45 :     }
  46 : 
  47 :     model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1(stan::io::var_context& context__,
  48 :         unsigned int random_seed__,
  49 :         std::ostream* pstream__ = 0)
  50 :         : model_base_crtp(0) {
  51 :         ctor_body(context__, random_seed__, pstream__);
  52 :     }
  53 : 
  54 :     void ctor_body(stan::io::var_context& context__,
  55 :                    unsigned int random_seed__,
  56 :                    std::ostream* pstream__) {
  57 :         typedef double local_scalar_t__;
  58 : 
  59 :         boost::ecuyer1988 base_rng__ =
  60 :           stan::services::util::create_rng(random_seed__, 0);
  61 :         (void) base_rng__;  // suppress unused var warning
  62 : 
  63 :         current_statement_begin__ = -1;
  64 : 
  65 :         static const char* function__ = "model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1_namespace::model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1";
  66 :         (void) function__;  // dummy to suppress unused var warning
  67 :         size_t pos__;
  68 :         (void) pos__;  // dummy to suppress unused var warning
  69 :         std::vector<int> vals_i__;
  70 :         std::vector<double> vals_r__;
  71 :         local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
  72 :         (void) DUMMY_VAR__;  // suppress unused var warning
  73 : 
  74 :         try {
  75 :             // initialize data block variables from context__
  76 :             current_statement_begin__ = 1;
  77 :             context__.validate_dims("data initialization", "y_mean", "double", context__.to_vec());
  78 :             y_mean = double(0);
  79 :             vals_r__ = context__.vals_r("y_mean");
  80 :             pos__ = 0;
  81 :             y_mean = vals_r__[pos__++];
  82 : 
  83 : 
  84 :             // initialize transformed data variables
  85 :             // execute transformed data statements
  86 : 
  87 :             // validate transformed data
  88 : 
  89 :             // validate, set parameter ranges
  90 :             num_params_r__ = 0U;
  91 :             param_ranges_i__.clear();
  92 :             current_statement_begin__ = 1;
  93 :             num_params_r__ += 1;
  94 :         } catch (const std::exception& e) {
  95 :             stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
  96 :             // Next line prevents compiler griping about no return
  97 :             throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
  98 :         }
  99 :     }
 100 : 
 101 :     ~model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1() { }
 102 : 
 103 : 
 104 :     void transform_inits(const stan::io::var_context& context__,
 105 :                          std::vector<int>& params_i__,
 106 :                          std::vector<double>& params_r__,
 107 :                          std::ostream* pstream__) const {
 108 :         typedef double local_scalar_t__;
 109 :         stan::io::writer<double> writer__(params_r__, params_i__);
 110 :         size_t pos__;
 111 :         (void) pos__; // dummy call to supress warning
 112 :         std::vector<double> vals_r__;
 113 :         std::vector<int> vals_i__;
 114 : 
 115 :         current_statement_begin__ = 1;
 116 :         if (!(context__.contains_r("y")))
 117 :             stan::lang::rethrow_located(std::runtime_error(std::string("Variable y missing")), current_statement_begin__, prog_reader__());
 118 :         vals_r__ = context__.vals_r("y");
 119 :         pos__ = 0U;
 120 :         context__.validate_dims("parameter initialization", "y", "double", context__.to_vec());
 121 :         double y(0);
 122 :         y = vals_r__[pos__++];
 123 :         try {
 124 :             writer__.scalar_unconstrain(y);
 125 :         } catch (const std::exception& e) {
 126 :             stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable y: ") + e.what()), current_statement_begin__, prog_reader__());
 127 :         }
 128 : 
 129 :         params_r__ = writer__.data_r();
 130 :         params_i__ = writer__.data_i();
 131 :     }
 132 : 
 133 :     void transform_inits(const stan::io::var_context& context,
 134 :                          Eigen::Matrix<double, Eigen::Dynamic, 1>& params_r,
 135 :                          std::ostream* pstream__) const {
 136 :       std::vector<double> params_r_vec;
 137 :       std::vector<int> params_i_vec;
 138 :       transform_inits(context, params_i_vec, params_r_vec, pstream__);
 139 :       params_r.resize(params_r_vec.size());
 140 :       for (int i = 0; i < params_r.size(); ++i)
 141 :         params_r(i) = params_r_vec[i];
 142 :     }
 143 : 
 144 : 
 145 :     template <bool propto__, bool jacobian__, typename T__>
 146 :     T__ log_prob(std::vector<T__>& params_r__,
 147 :                  std::vector<int>& params_i__,
 148 :                  std::ostream* pstream__ = 0) const {
 149 : 
 150 :         typedef T__ local_scalar_t__;
 151 : 
 152 :         local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
 153 :         (void) DUMMY_VAR__;  // dummy to suppress unused var warning
 154 : 
 155 :         T__ lp__(0.0);
 156 :         stan::math::accumulator<T__> lp_accum__;
 157 :         try {
 158 :             stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);
 159 : 
 160 :             // model parameters
 161 :             current_statement_begin__ = 1;
 162 :             local_scalar_t__ y;
 163 :             (void) y;  // dummy to suppress unused var warning
 164 :             if (jacobian__)
 165 :                 y = in__.scalar_constrain(lp__);
 166 :             else
 167 :                 y = in__.scalar_constrain();
 168 : 
 169 :             // model body
 170 : 
 171 :             current_statement_begin__ = 1;
 172 :             lp_accum__.add(normal_log<propto__>(y, y_mean, 1));
 173 : 
 174 :         } catch (const std::exception& e) {
 175 :             stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
 176 :             // Next line prevents compiler griping about no return
 177 :             throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
 178 :         }
 179 : 
 180 :         lp_accum__.add(lp__);
 181 :         return lp_accum__.sum();
 182 : 
 183 :     } // log_prob()
 184 : 
 185 :     template <bool propto, bool jacobian, typename T_>
 186 :     T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,
 187 :                std::ostream* pstream = 0) const {
 188 :       std::vector<T_> vec_params_r;
 189 :       vec_params_r.reserve(params_r.size());
 190 :       for (int i = 0; i < params_r.size(); ++i)
 191 :         vec_params_r.push_back(params_r(i));
 192 :       std::vector<int> vec_params_i;
 193 :       return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);
 194 :     }
 195 : 
 196 : 
 197 :     void get_param_names(std::vector<std::string>& names__) const {
 198 :         names__.resize(0);
 199 :         names__.push_back("y");
 200 :     }
 201 : 
 202 : 
 203 :     void get_dims(std::vector<std::vector<size_t> >& dimss__) const {
 204 :         dimss__.resize(0);
 205 :         std::vector<size_t> dims__;
 206 :         dims__.resize(0);
 207 :         dimss__.push_back(dims__);
 208 :     }
 209 : 
 210 :     template <typename RNG>
 211 :     void write_array(RNG& base_rng__,
 212 :                      std::vector<double>& params_r__,
 213 :                      std::vector<int>& params_i__,
 214 :                      std::vector<double>& vars__,
 215 :                      bool include_tparams__ = true,
 216 :                      bool include_gqs__ = true,
 217 :                      std::ostream* pstream__ = 0) const {
 218 :         typedef double local_scalar_t__;
 219 : 
 220 :         vars__.resize(0);
 221 :         stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);
 222 :         static const char* function__ = "model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1_namespace::write_array";
 223 :         (void) function__;  // dummy to suppress unused var warning
 224 : 
 225 :         // read-transform, write parameters
 226 :         double y = in__.scalar_constrain();
 227 :         vars__.push_back(y);
 228 : 
 229 :         double lp__ = 0.0;
 230 :         (void) lp__;  // dummy to suppress unused var warning
 231 :         stan::math::accumulator<double> lp_accum__;
 232 : 
 233 :         local_scalar_t__ DUMMY_VAR__(std::numeric_limits<double>::quiet_NaN());
 234 :         (void) DUMMY_VAR__;  // suppress unused var warning
 235 : 
 236 :         if (!include_tparams__ && !include_gqs__) return;
 237 : 
 238 :         try {
 239 :             if (!include_gqs__ && !include_tparams__) return;
 240 :             if (!include_gqs__) return;
 241 :         } catch (const std::exception& e) {
 242 :             stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());
 243 :             // Next line prevents compiler griping about no return
 244 :             throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");
 245 :         }
 246 :     }
 247 : 
 248 :     template <typename RNG>
 249 :     void write_array(RNG& base_rng,
 250 :                      Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,
 251 :                      Eigen::Matrix<double,Eigen::Dynamic,1>& vars,
 252 :                      bool include_tparams = true,
 253 :                      bool include_gqs = true,
 254 :                      std::ostream* pstream = 0) const {
 255 :       std::vector<double> params_r_vec(params_r.size());
 256 :       for (int i = 0; i < params_r.size(); ++i)
 257 :         params_r_vec[i] = params_r(i);
 258 :       std::vector<double> vars_vec;
 259 :       std::vector<int> params_i_vec;
 260 :       write_array(base_rng, params_r_vec, params_i_vec, vars_vec, include_tparams, include_gqs, pstream);
 261 :       vars.resize(vars_vec.size());
 262 :       for (int i = 0; i < vars.size(); ++i)
 263 :         vars(i) = vars_vec[i];
 264 :     }
 265 : 
 266 :     std::string model_name() const {
 267 :         return "model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1";
 268 :     }
 269 : 
 270 : 
 271 :     void constrained_param_names(std::vector<std::string>& param_names__,
 272 :                                  bool include_tparams__ = true,
 273 :                                  bool include_gqs__ = true) const {
 274 :         std::stringstream param_name_stream__;
 275 :         param_name_stream__.str(std::string());
 276 :         param_name_stream__ << "y";
 277 :         param_names__.push_back(param_name_stream__.str());
 278 : 
 279 :         if (!include_gqs__ && !include_tparams__) return;
 280 : 
 281 :         if (include_tparams__) {
 282 :         }
 283 : 
 284 :         if (!include_gqs__) return;
 285 :     }
 286 : 
 287 : 
 288 :     void unconstrained_param_names(std::vector<std::string>& param_names__,
 289 :                                    bool include_tparams__ = true,
 290 :                                    bool include_gqs__ = true) const {
 291 :         std::stringstream param_name_stream__;
 292 :         param_name_stream__.str(std::string());
 293 :         param_name_stream__ << "y";
 294 :         param_names__.push_back(param_name_stream__.str());
 295 : 
 296 :         if (!include_gqs__ && !include_tparams__) return;
 297 : 
 298 :         if (include_tparams__) {
 299 :         }
 300 : 
 301 :         if (!include_gqs__) return;
 302 :     }
 303 : 
 304 : }; // model
 305 : 
 306 : }  // namespace
 307 : 
 308 : typedef model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1_namespace::model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1 stan_model;
 309 : 
 310 : #ifndef USING_R
 311 : 
 312 : stan::model::model_base& new_model(
 313 :         stan::io::var_context& data_context,
 314 :         unsigned int seed,
 315 :         std::ostream* msg_stream) {
 316 :   stan_model* m = new stan_model(data_context, seed, msg_stream);
 317 :   return *m;
 318 : }
 319 : 
 320 : #endif
 321 : 
 322 : 
 323 : 
 324 : #include <rstan_next/stan_fit.hpp>
 325 : 
 326 : struct stan_model_holder {
 327 :     stan_model_holder(rstan::io::rlist_ref_var_context rcontext,
 328 :                       unsigned int random_seed)
 329 :     : rcontext_(rcontext), random_seed_(random_seed)
 330 :      {
 331 :      }
 332 : 
 333 :    //stan::math::ChainableStack ad_stack;
 334 :    rstan::io::rlist_ref_var_context rcontext_;
 335 :    unsigned int random_seed_;
 336 : };
 337 : 
 338 : Rcpp::XPtr<stan::model::model_base> model_ptr(stan_model_holder* smh) {
 339 :   Rcpp::XPtr<stan::model::model_base> model_instance(new stan_model(smh->rcontext_, smh->random_seed_), true);
 340 :   return model_instance;
 341 : }
 342 : 
 343 : Rcpp::XPtr<rstan::stan_fit_base> fit_ptr(stan_model_holder* smh) {
 344 :   return Rcpp::XPtr<rstan::stan_fit_base>(new rstan::stan_fit(model_ptr(smh), smh->random_seed_), true);
 345 : }
 346 : 
 347 : std::string model_name(stan_model_holder* smh) {
 348 :   return model_ptr(smh).get()->model_name();
 349 : }
 350 : 
 351 : RCPP_MODULE(stan_fit4model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1_mod){
 352 :   Rcpp::class_<stan_model_holder>("stan_fit4model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1")
 353 :   .constructor<rstan::io::rlist_ref_var_context, unsigned int>()
 354 :   .method("model_ptr", &model_ptr)
 355 :   .method("fit_ptr", &fit_ptr)
 356 :   .method("model_name", &model_name)
 357 :   ;
 358 : }
 359 : 
 360 : 
 361 : // declarations
 362 : extern "C" {
 363 : SEXP file296cf62657a( ) ;
 364 : }
 365 : 
 366 : // definition
 367 : 
 368 : SEXP file296cf62657a(  ){
 369 :  return Rcpp::wrap("73fc79f8b1915e8208c736914c86d1a1");
 370 : }
 371 : 
 372 : 
Compilation argument:
 C:/PROGRA~1/R/R-40~1.2/bin/x64/R CMD SHLIB file296cf62657a.cpp 2> file296cf62657a.cpp.err.txt 
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file296cf62657a.o:file296cf62657a.cpp:(.text+0x6bc): 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: file296cf62657a.o:file296cf62657a.cpp:(.text+0x1207): undefined reference to `rstan::stan_fit::stan_fit(SEXPREC*, int)'
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file296cf62657a.o:file296cf62657a.cpp:(.text+0x6fe): 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: file296cf62657a.o:file296cf62657a.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: file296cf62657a.o:file296cf62657a.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: file296cf62657a.o:file296cf62657a.cpp:(.text$_ZN4stan4math16ad_tape_observerD1Ev[_ZN4stan4math16ad_tape_observerD1Ev]+0x15): 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: file296cf62657a.o:file296cf62657a.cpp:(.text$_ZN4stan4math16ad_tape_observerD1Ev[_ZN4stan4math16ad_tape_observerD1Ev]+0x47): 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: file296cf62657a.o:file296cf62657a.cpp:(.text$_ZN4stan4math16ad_tape_observerD0Ev[_ZN4stan4math16ad_tape_observerD0Ev]+0x15): more undefined references to `tbb::internal::task_scheduler_observer_v3::observe(bool)' follow
collect2.exe: error: ld returned 1 exit status

ERROR(s) during compilation: source code errors or compiler configuration errors!

Program source:
  1: 
  2: // includes from the plugin
  3: // [[Rcpp::plugins(cpp14)]]
  4: 
  5: 
  6: // user includes
  7: #include <Rcpp.h>
  8: #include <rstan/io/rlist_ref_var_context.hpp>
  9: #include <rstan/io/r_ostream.hpp>
 10: #include <rstan/stan_args.hpp>
 11: #include <boost/integer/integer_log2.hpp>
 12: // Code generated by Stan version 2.21.0
 13: 
 14: #include <stan/model/model_header.hpp>
 15: 
 16: namespace model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1_namespace {
 17: 
 18: using std::istream;
 19: using std::string;
 20: using std::stringstream;
 21: using std::vector;
 22: using stan::io::dump;
 23: using stan::math::lgamma;
 24: using stan::model::prob_grad;
 25: using namespace stan::math;
 26: 
 27: static int current_statement_begin__;
 28: 
 ... (code too long to post)
311: 
312: stan::model::model_base& new_model(
313:         stan::io::var_context& data_context,
314:         unsigned int seed,
315:         std::ostream* msg_stream) {
316:   stan_model* m = new stan_model(data_context, seed, msg_stream);
317:   return *m;
318: }
319: 
320: #endif
321: 
322: 
323: 
324: #include <rstan_next/stan_fit.hpp>
325: 
326: struct stan_model_holder {
327:     stan_model_holder(rstan::io::rlist_ref_var_context rcontext,
328:                       unsigned int random_seed)
329:     : rcontext_(rcontext), random_seed_(random_seed)
330:      {
331:      }
332: 
333:    //stan::math::ChainableStack ad_stack;
334:    rstan::io::rlist_ref_var_context rcontext_;
335:    unsigned int random_seed_;
336: };
337: 
338: Rcpp::XPtr<stan::model::model_base> model_ptr(stan_model_holder* smh) {
339:   Rcpp::XPtr<stan::model::model_base> model_instance(new stan_model(smh->rcontext_, smh->random_seed_), true);
340:   return model_instance;
341: }
342: 
343: Rcpp::XPtr<rstan::stan_fit_base> fit_ptr(stan_model_holder* smh) {
344:   return Rcpp::XPtr<rstan::stan_fit_base>(new rstan::stan_fit(model_ptr(smh), smh->random_seed_), true);
345: }
346: 
347: std::string model_name(stan_model_holder* smh) {
348:   return model_ptr(smh).get()->model_name();
349: }
350: 
351: RCPP_MODULE(stan_fit4model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1_mod){
352:   Rcpp::class_<stan_model_holder>("stan_fit4model296c5a1f790d_73fc79f8b1915e8208c736914c86d1a1")
353:   .constructor<rstan::io::rlist_ref_var_context, unsigned int>()
354:   .method("model_ptr", &model_ptr)
355:   .method("fit_ptr", &fit_ptr)
356:   .method("model_name", &model_name)
357:   ;
358: }
359: 
360: 
361: // declarations
362: extern "C" {
363: SEXP file296cf62657a( ) ;
364: }
365: 
366: // definition
367: 
368: SEXP file296cf62657a(  ){
369:  return Rcpp::wrap("73fc79f8b1915e8208c736914c86d1a1");
370: }
371: 
372: 
Error in compileCode(f, code, language = language, verbose = verbose): Compilation ERROR, function(s)/method(s) not created! C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file296cf62657a.o:file296cf62657a.cpp:(.text+0x6bc): 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: file296cf62657a.o:file296cf62657a.cpp:(.text+0x1207): undefined reference to `rstan::stan_fit::stan_fit(SEXPREC*, int)'
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file296cf62657a.o:file296cf62657a.cpp:(.text+0x6fe): 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: file296cf62657a.o:file296cf62657a.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: file296cf62657a.o:file296cf62657a.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: file296cf62657a.o:file296cf62657a.cpp:(.text$_ZN4stan4math16ad_tape_observerD1Ev[_ZN4stan4math16ad_tape_observerD1Ev]+0x15): 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: file296cf62657a.o:file296cf62657a.cpp:(.text$_ZN4stan4math16ad_tape_observerD1Ev[_ZN4stan4math16ad_tape_observerD1Ev]+0x47): 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: file296cf62657a.o:file296cf62657a.cpp:(.text$_ZN4stan4math16ad_tape_observerD0Ev[_ZN4stan4math16ad_tape_observerD0Ev]+0x15): more undefined references to `tbb::internal::task_scheduler_observer_v3::observe(bool)' follow
collect2.exe: error: ld returned 1 exit status
Traceback:

1. example(stan_model, package = "rstan", run.dontrun = TRUE)
2. source(tf, local, echo = echo, prompt.echo = paste0(prompt.prefix, 
 .     getOption("prompt")), continue.echo = paste0(prompt.prefix, 
 .     getOption("continue")), verbose = verbose, max.deparse.length = Inf, 
 .     encoding = "UTF-8", skip.echo = skips, keep.source = TRUE)
3. withVisible(eval(ei, envir))
4. eval(ei, envir)
5. eval(ei, envir)
6. stan_model(model_code = stancode, verbose = TRUE)   # at line 9 of file C:\Users\nlinton\AppData\Local\Temp\RtmpYDnKOB\Rex296c124d6c8b
7. cxxfunctionplus(signature(), body = paste(" return Rcpp::wrap(\"", 
 .     model_name, "\");", sep = ""), includes = inc, plugin = "rstan", 
 .     save_dso = save_dso | auto_write, module_name = paste("stan_fit4", 
 .         model_cppname, "_mod", sep = ""), verbose = verbose)
8. pkgbuild::with_build_tools(cxxfunction(sig = sig, body = body, 
 .     plugin = plugin, includes = includes, settings = settings, 
 .     ..., verbose = verbose), required = rstan_options("required") && 
 .     !identical(Sys.getenv("WINDOWS"), "TRUE") && !identical(Sys.getenv("R_PACKAGE_SOURCE"), 
 .     ""))
9. withr::with_path(rtools_path(), code)
10. force(code)
11. cxxfunction(sig = sig, body = body, plugin = plugin, includes = includes, 
  .     settings = settings, ..., verbose = verbose)
12. compileCode(f, code, language = language, verbose = verbose)
13. stop(paste("Compilation ERROR, function(s)/method(s) not created!", 
  .     paste(errmsg, collapse = "\n")))

I am going to try to build new provisional binaries, but

remotes::install_github("stan-dev/rstan", ref = "develop", subdir = "rstan/rstan")

should work regardless of what OS you are using.

Hi,

I had similar problems and so followed your instructions in this thread. I’m afraid this install command did not work either for me. I get the following error (bold mine):

remotes::install_github(“stan-dev/rstan”, ref = “develop”, subdir = “rstan/rstan”)

Downloading GitHub repo stan-dev/rstan@develop
“C:/Program Files/Git/bin/git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop GitHub - stan-dev/stan: Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details. C:\Users\Thomasm\AppData\Local\Temp\RtmpoDGvfv\remotes389c5b14301/stan-dev-rstan-0eebee1/rstan/rstan/…/…/StanHeaders/inst/include/upstream
Error: Failed to install ‘rstan’ from GitHub:
Command failed (128)
In addition: Warning messages:
1: In untar2(tarfile, files, list, exdir) :
failed to copy ‘stan-dev-rstan-0eebee1/StanHeaders/inst/include/mathlib/lib/sundials_4.1.0’ to ‘stan-dev-rstan-0eebee1/StanHeaders/inst/include/libsundials’
2: In untar2(tarfile, files, list, exdir) :
failed to copy ‘stan-dev-rstan-0eebee1/StanHeaders/inst/include/upstream/src’ to ‘stan-dev-rstan-0eebee1/StanHeaders/inst/include/src’
3: In untar2(tarfile, files, list, exdir) :
failed to copy ‘stan-dev-rstan-0eebee1/StanHeaders/inst/include/mathlib/stan’ to ‘stan-dev-rstan-0eebee1/StanHeaders/inst/include/stan’
4: In untar2(tarfile, files, list, exdir) :
skipping pax global extended headers
5: In untar2(tarfile, files, list, exdir) :
skipping pax global extended headers
6: In system(full, intern = TRUE, ignore.stderr = quiet) :
running command ‘“C:/Program Files/Git/bin/git.exe” clone --depth 1 --no-hardlinks --recurse-submodules --branch develop GitHub - stan-dev/stan: Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details. C:\Users\Thomasm\AppData\Local\Temp\RtmpoDGvfv\remotes389c5b14301/stan-dev-rstan-0eebee1/rstan/rstan/…/…/StanHeaders/inst/include/upstream’ had status 128

Session info:

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 14393)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_4.0.2 assertthat_0.2.1 cli_2.0.2 tools_4.0.2 withr_2.2.0 glue_1.4.1
[7] rstudioapi_0.11 crayon_1.3.4 fansi_0.4.1 sessioninfo_1.1.1

OK. Winbuilder is not producing binaries at the moment, but I’ll keep trying.

1 Like

@bgoodri - Thank you for all of your help. I have run into the same issues, and I have tried the fixes proposed in this thread as well as the suggested steps in a related thread (Not able to run Eight Schools example on rstan 2.21.1 & StanHeaders 2.21.0-5) with no luck.

I tried running:

install.packages(
    "https://win-builder.r-project.org/8bPDZPDG0522/rstan_2.21.2.zip",
    repos = NULL, type = "win.binary")

But got the error message:

Warning in install.packages :
  cannot open URL 'https://win-builder.r-project.org/8bPDZPDG0522/rstan_2.21.2.zip': HTTP status was '404 Not Found'
Error in download.file(p, destfile, method, mode = "wb", ...) : 
  cannot open URL 'https://win-builder.r-project.org/8bPDZPDG0522/rstan_2.21.2.zip'

Did the ZIP file get removed?

My session info:

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_4.0.2  htmltools_0.4.0 tools_4.0.2     yaml_2.2.1      Rcpp_1.0.4.6    rmarkdown_2.3  
 [7] knitr_1.28      xfun_0.14       digest_0.6.25   packrat_0.5.0   rlang_0.4.6     evaluate_0.14

Yeah, and it won’t let me created another one.

edited: @bgoodri - the fix you posted in Rstan on Windows worked for me! Many thanks.

Dear @bgoodri, the fix also works for me. I appreciate your time and consideration a lot!

@bgoodri

I met the problem like this, and I try to reinstall R and R studio can not solve this problem.

[quote=“mpthacker, post:1, topic:16466, full:true”]
I seem to be far from the first person to run into this type of error when getting rstan up and running for the first time, but after reinstalling rstan several times and making sure that both R and rstan are installed on my C:\ drive I am unsure where to go to continue troubleshooting this error. My apologies if I have missed an obvious solution previously posted. Here is the error message I get when I try and run the simple 8 schools model from the installation tutorial:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! C:/RBUILD~1/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file3438dfd7e9c.o:file3438dfd7e9c.cpp:(.text+0x11dc): undefined reference to `rstan::stan_fit::stan_fit(SEXPREC*, int)'
C:/RBUILD~1/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file3438dfd7e9c.o:file3438dfd7e9c.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D1Ev[_ZN3tbb8internal26task_scheduler_observer_v3D1Ev]+0x14): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'
C:/RBUILD~1/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file3438dfd7e9c.o:file3438dfd7e9c.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1c): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'
C:/RBUILD~1/4.0/mingw64/bin/.
In addition: Warning messages:
1: In readLines(file, warn = TRUE) :
  incomplete final line found on 'C:\Users\matth\Documents\College Work\FunStats\usgs_gages_proj\Testing\schools.stan'
2: In file.remove(c(unprocessed, processed)) :
  cannot remove file 'C:\Users\matth\AppData\Local\Temp\RtmpCWBON7\file34382d5c18b4.stan', reason 'No such file or directory'
Error in sink(type = "output") : invalid connection

And here is my 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=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

other attached packages:
[1] rstan_2.21.1         ggplot2_3.3.2       
[3] StanHeaders_2.21.0-5

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5         pillar_1.4.4      
 [3] compiler_4.0.2     prettyunits_1.1.1 
 [5] remotes_2.1.1      tools_4.0.2       
 [7] pkgbuild_1.0.8     jsonlite_1.7.0    
 [9] lifecycle_0.2.0    tibble_3.0.2      
[11] gtable_0.3.0       pkgconfig_2.0.3   
[13] rlang_0.4.6        cli_2.0.2         
[15] rstudioapi_0.11    parallel_4.0.2    
[17] curl_4.3           loo_2.3.0         
[19] gridExtra_2.3      withr_2.2.0       
[21] dplyr_1.0.0        generics_0.0.2    
[23] vctrs_0.3.1        stats4_4.0.2      
[25] grid_4.0.2         tidyselect_1.1.0  
[27] glue_1.4.1         inline_0.3.15     
[29] R6_2.4.1           processx_3.4.3    
[31] fansi_0.4.1        purrr_0.3.4       
[33] callr_3.4.3        magrittr_1.5      
[35] codetools_0.2-16   matrixStats_0.56.0
[37] scales_1.1.1       ps_1.3.3          
[39] ellipsis_0.3.1     assertthat_0.2.1  
[41] colorspace_1.4-1   V8_3.2.0          
[43] RcppParallel_5.0.2 munsell_0.5.0     
[45] crayon_1.3.4 

Operating System: Windows 10
Interface Version: 2.19.2
Compiler/Toolkit: rstan/rstudio

  • List item
    Error in compileCode(f, code, language = language, verbose = verbose) :
    C:/RBuildTools/4.0/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file4f3423e16be6.o:file4f3423e16be6.cpp:(.text+0xb7a): undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/RBuildTools/4.0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file4f3423e16be6.o:file4f3423e16be6.cpp:(.text+0xba4): undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/RBuildTools/4.0/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file4f3423e16be6.o:file4f3423e16be6.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D1Ev[_ZN3tbb8internal26task_scheduler_observer_v3D1Ev]+0x14): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/RBuildTools/4.0/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file4f3423e16be6.o:file4f3423e16be6.cpp:(.tex
    Error in sink(type = “output”) : invalid connection

  • List item
    R version 4.2.0 (2022-04-22 ucrt)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.utf8 LC_CTYPE=Chinese (Simplified)_China.utf8
[3] LC_MONETARY=Chinese (Simplified)_China.utf8 LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.utf8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4
[5] readr_2.1.2 tidyr_1.2.0 tibble_3.1.7 tidyverse_1.3.1
[9] rstan_2.21.5 ggplot2_3.3.6 StanHeaders_2.21.0-7

loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 lubridate_1.8.0 prettyunits_1.1.1 ps_1.7.0 assertthat_0.2.1
[6] utf8_1.2.2 R6_2.5.1 cellranger_1.1.0 backports_1.4.1 reprex_2.0.1
[11] stats4_4.2.0 httr_1.4.3 pillar_1.7.0 rlang_1.0.2 readxl_1.4.0
[16] rstudioapi_0.13 callr_3.7.0 loo_2.5.1 bit_4.0.4 munsell_0.5.0
[21] broom_0.8.0 compiler_4.2.0 modelr_0.1.8 pkgconfig_2.0.3 pkgbuild_1.3.1
[26] tidyselect_1.1.2 gridExtra_2.3 codetools_0.2-18 matrixStats_0.62.0 fansi_1.0.3
[31] crayon_1.5.1 tzdb_0.3.0 dbplyr_2.1.1 withr_2.5.0 grid_4.2.0
[36] jsonlite_1.8.0 gtable_0.3.0 lifecycle_1.0.1 DBI_1.1.2 magrittr_2.0.3
[41] scales_1.2.0 RcppParallel_5.1.5 cli_3.3.0 stringi_1.7.6 vroom_1.5.7
[46] fs_1.5.2 xml2_1.3.3 ellipsis_0.3.2 generics_0.1.2 vctrs_0.4.1
[51] tools_4.2.0 bit64_4.0.5 glue_1.6.2 hms_1.1.1 processx_3.5.3
[56] parallel_4.2.0 inline_0.3.19 colorspace_2.0-3 rvest_1.0.2 haven_2.5.0

  • List item
    dir(system.file(“lib”, package = “rstan”), recursive = TRUE, full.names = TRUE) Return
    [1] “C:/Users/12209/AppData/Local/R/win-library/4.2/rstan/lib/x64/libStanServices.a”

when i run example(stan_model, package = “rstan”, run.dontrun = TRUE), i get that

  • List item
    Compilation ERROR, function(s)/method(s) not created!
    Error in compileCode(f, code, language = language, verbose = verbose) :
    C:/RBuildTools/4.0/ucrt64/bin/…/lib/gcc/x86_64-w64-mingw32/10.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file3ab848977fbf.o:file3ab848977fbf.cpp:(.text.startup+0x850e): undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/RBuildTools/4.0/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file3ab848977fbf.o:file3ab848977fbf.cpp:(.text.startup+0x8d3a): undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/RBuildTools/4.0/ucrt64/bin/…/lib/gcc/x86_64-w64-mingw32/10.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file3ab848977fbf.o:file3ab848977fbf.cpp:(.text.startup+0x8d60): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/RBuildTools/4.0/ucrt64/bin/…/lib/gcc/x86_64-w64-mingw32/10.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file3ab848977fbf.o:file3ab848977fbf.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26ta

Have solve this problem by downgrade the R 4.2.0 to R 4.0.2 and Rtool from 42 to 40~ hope this solution work for you so~