Error in compileCode without reinstalling


I think my error is from the “classics” and it seems that re-installing rstan could be a solution. However, my company is vetting every single package that I need to install. Then they through the installed folder in my library and this is how it works.

My question is if I can make the current rstan instalation to work.

The error I’m getting by running the following,

R > example(stan_model, package = "rstan", run.dontrun = TRUE) is

Compilation ERROR, function(s)/method(s) not created! Error in compileCode(f, code, language = language, verbose = verbose) : C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file45cc4bb579e5.o:file45cc4bb579e5.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file45cc4bb579e5.o:file45cc4bb579e5.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file45cc4bb579e5.o:file45cc4bb579e5.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x3a): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:\rtools42\x86_64-w64-mingw32.static.posix\bin/ld.exe: file45cc4bb579e5.o:file45cc4bb579e5.cpp:(.text$_ZN3tbb10interface

The makevars is

CXX14 = (BINPREF)g++ -m(WIN) -std=c++1y
CXX14FLAGS += -mtune=native -march=native -Wno-ignored-attributes -Wno-deprecated-declarations


R > sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

[1] LC_COLLATE=English_United Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8
[3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.utf8

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

other attached packages:
[1] rstan_2.21.7 ggplot2_3.4.0 StanHeaders_2.21.0-7 RcppEigen_0. Rcpp_1.0.9

loaded via a namespace (and not attached):
[1] pillar_1.8.1 compiler_4.2.1 prettyunits_1.1.1 tools_4.2.1 pkgbuild_1.3.1
[6] lifecycle_1.0.3 tibble_3.1.8 gtable_0.3.1 lattice_0.20-45 pkgconfig_2.0.3
[11] rlang_1.0.6 Matrix_1.5-1 cli_3.4.1 DBI_1.1.3 rstudioapi_0.14
[16] parallel_4.2.1 loo_2.5.1 gridExtra_2.3 withr_2.5.0 dplyr_1.0.10
[21] generics_0.1.3 fs_1.5.2 vctrs_0.5.1 stats4_4.2.1 grid_4.2.1
[26] tidyselect_1.2.0 glue_1.6.2 inline_0.3.19 R6_2.5.1 processx_3.8.0
[31] fansi_1.0.3 callr_3.7.3 purrr_0.3.5 magrittr_2.0.3 codetools_0.2-18
[36] matrixStats_0.62.0 ps_1.7.2 scales_1.2.1 usethis_2.1.6 assertthat_0.2.1
[41] colorspace_2.0-3 utf8_1.2.2 RcppParallel_5.1.5 munsell_0.5.0 crayon_1.5.2

Thanks for your time.

See the Getting Started guide

Oh I see now 😬
So should it be the 2.26 or the latest version can do the job too?

If you want to use R4.2 you’ll have to use rstan 2.26

1 Like