Installation issue on Windows 10

Hello,

I’ve been using Rstan on my Mac, but I cannot get it working on my Windows 10 laptop. The installation proceeds without error and I confirmed that the R build tools are installed. However, when running any Stan model, I get an error. My colleagues are having the same issue on their Windows laptop (while they are able to use rstan on their Mac). We spent a couple of days trying to troubleshoot without success. Error and installation details are below.

Error:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! C:/RBuildTools/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file2b046b957ecf.o:file2b046b957ecf.cpp:(.text+0x12ac): undefined reference to rstan::stan_fit::stan_fit(SEXPREC*, int)' C:/RBuildTools/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: file2b046b957ecf.o:file2b046b957ecf.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D1Ev[_ZN3tbb8internal26task_scheduler_observer_v3D1Ev]+0x14): undefined reference to tbb::internal::task_scheduler_observer_v3::observe(bool)’
C:/RBuildTools/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file2b046b957ecf.o:file2b046b957ecf.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1c): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)’
C:/RBuildTools/mingw64/bin
In addition: Warning message:
In file.remove(c(unprocessed, processed)) :
cannot remove file ‘C:\Users\LUGUCC~1\AppData\Local\Temp\RtmpkPRqEc\file2b04bcf454b.stan’, reason ‘No such file or directory’
Error in sink(type = “output”) : invalid connection

Info related to installation:

  • Operating System: Windows 10
  • Rstan version: 2.21.1
  • Output of devtools::session_info(“rstan”)
  • Session info ----------------------------------------
    setting value
    version R version 4.0.2 (2020-06-22)
    os Windows 10 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate English_United States.1252
    ctype English_United States.1252
    tz America/New_York
    date 2020-07-17

  • Packages --------------------------------------------
    ! package * version date lib
    assertthat 0.2.1 2019-03-21 [1]
    backports 1.1.7 2020-05-13 [1]
    BH 1.72.0-3 2020-01-08 [1]
    callr 3.4.3 2020-03-28 [1]
    checkmate 2.0.0 2020-02-06 [1]
    cli 2.0.2 2020-02-28 [1]
    colorspace 1.4-1 2019-03-18 [1]
    crayon 1.3.4 2017-09-16 [1]
    curl 4.3 2019-12-02 [1]
    desc 1.2.0 2018-05-01 [1]
    digest 0.6.25 2020-02-23 [1]
    ellipsis 0.3.1 2020-05-15 [1]
    evaluate 0.14 2019-05-28 [1]
    fansi 0.4.1 2020-01-08 [1]
    farver 2.0.3 2020-01-16 [1]
    ggplot2 3.3.2 2020-06-19 [1]
    glue 1.4.1 2020-05-13 [1]
    gridExtra 2.3 2017-09-09 [1]
    gtable 0.3.0 2019-03-25 [1]
    inline 0.3.15 2018-05-18 [1]
    isoband 0.2.2 2020-06-20 [1]
    jsonlite 1.7.0 2020-06-25 [1]
    labeling 0.3 2014-08-23 [1]
    lattice 0.20-41 2020-04-02 [1]
    lifecycle 0.2.0 2020-03-06 [1]
    loo 2.3.1 2020-07-14 [1]
    magrittr 1.5 2014-11-22 [1]
    MASS 7.3-51.6 2020-04-26 [1]
    Matrix 1.2-18 2019-11-27 [1]
    matrixStats 0.56.0 2020-03-13 [1]
    mgcv 1.8-31 2019-11-09 [1]
    munsell 0.5.0 2018-06-12 [1]
    nlme 3.1-148 2020-05-24 [1]
    pillar 1.4.6 2020-07-10 [1]
    pkgbuild 1.1.0 2020-07-13 [1]
    pkgconfig 2.0.3 2019-09-22 [1]
    pkgload 1.1.0 2020-05-29 [1]
    praise 1.0.0 2015-08-11 [1]
    prettyunits 1.1.1 2020-01-24 [1]
    processx 3.4.3 2020-07-05 [1]
    ps 1.3.3 2020-05-08 [1]
    R6 2.4.1 2019-11-12 [1]
    RColorBrewer 1.1-2 2014-12-07 [1]
    Rcpp 1.0.5 2020-07-06 [1]
    RcppEigen 0.3.3.7.0 2019-11-16 [1]
    D RcppParallel 5.0.2 2020-06-24 [1]
    rlang 0.4.6 2020-05-02 [1]
    rprojroot 1.3-2 2018-01-03 [1]
    rstan 2.21.1 2020-07-08 [1]
    rstudioapi 0.11 2020-02-07 [1]
    scales 1.1.1 2020-05-11 [1]
    StanHeaders 2.21.0-5 2020-06-09 [1]
    testthat 2.3.2 2020-03-02 [1]
    tibble 3.0.2 2020-07-07 [1]
    utf8 1.1.4 2018-05-24 [1]
    V8 3.2.0 2020-06-19 [1]
    vctrs 0.3.1 2020-06-05 [1]
    viridisLite 0.3.0 2018-02-01 [1]
    withr 2.2.0 2020-04-20 [1]
    source
    CRAN (R 4.0.2)
    CRAN (R 4.0.0)
    CRAN (R 4.0.0)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.0)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.0)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)
    CRAN (R 4.0.2)

[1] C:/Users/luguccioni/R/R-4.0.2/library

D – DLL MD5 mismatch, broken installation.

  • Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))
    CXX14FLAGS=-O3 -march=corei7 -mtune=corei7
    CXX14 = (BINPREF)g++ -m(WIN) -std=c++1y
    CXX11FLAGS=-O3 -march=corei7 -mtune=corei7

Sorry you’re getting an error. Does this post on Windows issues help? Rstan on Windows

Hi Jonah, Thanks ! I am actually just testing it out (I had missed it earlier).

It did work ! Sorry, I should have checked earlier. I had done a through search when I first tried troubleshooting this issue a year ago, and gave up quickly this time around. - Laura

Glad that’s working!

Thanks ! Me too. :) Very happy about that.