Odd error message after uppgrading to R 4.0

I (or rather my IT department) updated to R 4.0 and I can no longer get rstan to work. The same code that worked before gives error messages. At first, I got errors along the lines of this thread: Error: cannot allocate vector of size 13813.6 Gb - #8 by jonah , i.e. “cannot allocate vector of [several TB]”. I have followed the steps propsed here: Dealing with R 4.0 , and that seems to have resolved the initial error message (at least after I removed the rds-file before compilation). However, a new set of errors emerges:

Error in file(con, “r”) : cannot open the connection
In addition: Warning messages:
1: In system(cmd, intern = !verbose) :
running command ‘C:/PROGRA~1/R/R-40~1.0PA/bin/x64/R CMD SHLIB file39207db27ba3.cpp 2> file39207db27ba3.cpp.err.txt’ had status 1
2: In file(con, “r”) :
cannot open file ‘file39207db27ba3.cpp.err.txt’: No such file or directory
Error in sink(type = “output”) : invalid connection

Additional info:

The platform is windows 10.

When I implement the suggested “writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”)))”, RStudio says the file doesn’t exist, but if I change to Makevars.win, I get the following:

CXX14FLAGS=-O3 -march=native
CXX14 = g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3 -march=native

CXX14FLAGS=-O3 -march=native
CXX14 = g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3 -march=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native -mtune=native
CXX11FLAGS=-O3 -march=native -mtune=native

CXX14FLAGS=-O3 -march=native
CXX14 = g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3 -march=native

CXX14FLAGS=-O3 -march=native
CXX14 = g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3 -march=native

CXX14FLAGS=-O3
CXX11FLAGS=-O3

CXX14FLAGS=-O3
CXX11FLAGS=-O3
CXX14FLAGS += -mtune=native -march=native -Wno-ignored-attributes -Wno-deprecated-declarationsCXX14FLAGS += -mtune=native -march=native -Wno-ignored-attributes -Wno-deprecated-declarations

Output of devtools::session_info("rstan")

Error in loadNamespace(name) : there is no package called ‘devtools’

After installing devtools and re-executing:

  • Session info ----------------------------------------------------------------------------------------------------
    setting value
    version R version 4.0.0 Patched (2020-05-13 r78456)
    os Windows 10 x64
    system x86_64, mingw32
    ui RStudio
    language (EN)
    collate English_United States.1252
    ctype English_United States.1252
    tz Europe/Berlin
    date 2020-05-14

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

[1] C:/Users/tomli96/Documents/R/win-library/4.0
[2] C:/Program Files/R/R-4.0.0patched/library

Very grateful for any pointers.

I would delete the Makevars.win file and try

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

and if that does not work, give us the compilation statement underneath the line that says “Compilation argument:”. Once we get that working, we can fix the Makevars.win file.

Thank you so much! It’s running now.