Stan not running after updating to r version 4.0.2 and stan updated from 2.19.3 to 2.21

I am sorry to say that I share the experiences reported in this forum by all the users of Windows 10, R 4.0.2, RStudio 1.3.1056, Rtools 4.0, rstan 2.21.1 and StanHeaders 2.21.0.5. Would be great to have the matter sorted soon. All efforts much appreciated! Many thanks to all involved.

1 Like

Just verbose = TRUE and looking to the part of the output that says error: (with the colon), which is usually going to be a paragraph or two under the line that says “Compilation argument”.

I have the same problem. Here are some diagnostics from this example:

library(rstan)

m <- stan_model(model_code = 'parameters {real y;} model {y ~ normal(0,1);}',
                verbose = TRUE)
diagnostics TRANSLATING MODEL 'ea675482ff536c9af991981f83a71da2' FROM Stan CODE TO C++ CODE NOW. successful in parsing the Stan model 'ea675482ff536c9af991981f83a71da2'. The NEXT version of Stan will not be able to pre-process your Stan program. Please open an issue at https://github.com/stan-dev/stanc3/issues if you can share or at least describe your Stan program. This will help ensure that Stan continues to work on your Stan programs in the future. Thank you! This message can be avoided by wrapping your function call inside suppressMessages(). COMPILING THE C++ CODE FOR MODEL 'ea675482ff536c9af991981f83a71da2' NOW. OS: x86_64, mingw32; rstan: 2.21.1; Rcpp: 1.0.5; inline: 0.3.15 >> setting environment variables: PKG_LIBS = C:/R/Library/rstan/lib/x64/libStanServices.a -L"C:/R/Library/StanHeaders/libs/x64" -lStanHeaders -L"C:/R/Library/RcppParallel/lib/x64" -ltbb PKG_CPPFLAGS = -I"C:/R/Library/Rcpp/include/" -I"C:/R/Library/RcppEigen/include/" -I"C:/R/Library/RcppEigen/include/unsupported" -I"C:/R/Library/BH/include" -I"C:/R/Library/StanHeaders/include/src/" -I"C:/R/Library/StanHeaders/include/" -I"C:/R/Library/RcppParallel/include/" -I"C:/R/Library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include "C:/R/Library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp" -std=c++1y >> Program source :

1 :
2 : // includes from the plugin

364 :
Compilation argument:
C:/PROGRA~1/R/R-40~1.2/bin/x64/R CMD SHLIB file1d54743b5e77.cpp 2> file1d54743b5e77.cpp.err.txt
C:/rtools40/mingw64/bin/g++ -m64 -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -I"C:/R/Library/Rcpp/include/" -I"C:/R/Library/RcppEigen/include/" -I"C:/R/Library/RcppEigen/include/unsupported" -I"C:/R/Library/BH/include" -I"C:/R/Library/StanHeaders/include/src/" -I"C:/R/Library/StanHeaders/include/" -I"C:/R/Library/RcppParallel/include/" -I"C:/R/Library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include “C:/R/Library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp” -std=c++1y -march=core2 -include C:/R/Library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I “C:/R/Library/StanHeaders/include” -I “C:/R/Library/RcppEigen/include” -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -mtune=native -march=native -Wno-ignored-attributes -Wno-deprecated-declarations -c file1d54743b5e77.cpp -o file1d54743b5e77.o
In file included from C:/R/Library/BH/include/boost/mpl/aux_/na_assert.hpp:23,
from C:/R/Library/BH/include/boost/mpl/arg.hpp:25,
from C:/R/Library/BH/include/boost/mpl/placeholders.hpp:24,
from C:/R/Library/BH/include/boost/iterator/iterator_categories.hpp:16,
from C:/R/Library/BH/include/boost/iterator/iterator_facade.hpp:13,
from C:/R/Library/BH/include/boost/range/iterator_range_core.hpp:27,
from C:/R/Library/BH/include/boost/lexical_cast.hpp:30,
from C:/R/Library/rstan/include/rstan/stan_args.hpp:12,
from file1d54743b5e77.cpp:10:
C:/R/Library/BH/include/boost/mpl/assert.hpp:194:21: warning: unnecessary parentheses in declaration of ‘assert_arg’ [-Wparentheses]
failed ************ (Pred::************
^

In file included from C:/R/Library/RcppEigen/include/Eigen/Core:82,
from C:/R/Library/RcppEigen/include/Eigen/Dense:1,
from C:/R/Library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
from :
C:/rtools40/mingw64/include/c++/8.3.0/new:174:13: note: previous definition of ‘void operator delete(void*, void*)’ was here
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
^~~~~~~~
In file included from C:/R/Library/RcppParallel/include/tbb/parallel_for.h:25,
from C:/R/Library/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12,
from C:/R/Library/StanHeaders/include/stan/math/rev/mat.hpp:73,
from C:/R/Library/StanHeaders/include/stan/math.hpp:4,
from C:/R/Library/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file1d54743b5e77.cpp:14:
C:/R/Library/RcppParallel/include/tbb/task.h:1034:87: warning: optimization attribute on ‘void* operator new(size_t, const tbb::internal::allocate_child_proxy&)’ follows definition but the attribute doesn’t match [-Wattributes]
inline void operator new( size_t bytes, const tbb::internal::allocate_child_proxy& p ) {
^
In file included from C:/R/Library/RcppEigen/include/Eigen/Core:82,
from C:/R/Library/RcppEigen/include/Eigen/Dense:1,
from C:/R/Library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
from :
C:/rtools40/mingw64/include/c++/8.3.0/new:168:14: note: previous definition of 'void
operator new(std::size_t, void*)’ was here
inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
^~~~~~~~
In file included from C:/R/Library/RcppParallel/include/tbb/parallel_for.h:25,
from C:/R/Library/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12,
from C:/R/Library/StanHeaders/include/stan/math/rev/mat.hpp:73,
from C:/R/Library/StanHeaders/include/stan/math.hpp:4,
from C:/R/Library/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file1d54743b5e77.cpp:14:
C:/R/Library/RcppParallel/include/tbb/task.h:1038:87: warning: optimization attribute on ‘void operator delete(void*, const tbb::internal::allocate_child_proxy&)’ follows definition but the attribute doesn’t match [-Wattributes]
inline void operator delete( void* task, const tbb::internal::allocate_child_proxy& p ) {
^
In file included from C:/R/Library/RcppEigen/include/Eigen/Core:82,
from C:/R/Library/RcppEigen/include/Eigen/Dense:1,
from C:/R/Library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
from :
C:/rtools40/mingw64/include/c++/8.3.0/new:174:13: note: previous definition of ‘void operator delete(void*, void*)’ was here
inline void operator delete (void*, void*) _GLIBCXX_USE_NOEXCEPT { }
^~~~~~~~
In file included from C:/R/Library/RcppParallel/include/tbb/parallel_for.h:25,
from C:/R/Library/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12,
from C:/R/Library/StanHeaders/include/stan/math/rev/mat.hpp:73,
from C:/R/Library/StanHeaders/include/stan/math.hpp:4,
from C:/R/Library/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file1d54743b5e77.cpp:14:
C:/R/Library/RcppParallel/include/tbb/task.h:1042:101: warning: optimization attribute on ‘void* operator new(size_t, const tbb::internal::allocate_additional_child_of_proxy&)’ follows definition but the attribute doesn’t match [-Wattributes]
inline void operator new( size_t bytes, const tbb::internal::allocate_additional_child_of_proxy& p ) {
^
In file included from C:/R/Library/RcppEigen/include/Eigen/Core:82,
from C:/R/Library/RcppEigen/include/Eigen/Dense:1,
from C:/R/Library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
from :
C:/rtools40/mingw64/include/c++/8.3.0/new:168:14: note: previous definition of 'void
operator new(std::size_t, void*)’ was here
inline void* operator new(std::size_t, void* p) GLIBCXX_USE_NOEXCEPT
^~~~~~~~
In file included from C:/R/Library/RcppParallel/include/tbb/parallel_for.h:25,
from C:/R/Library/StanHeaders/include/stan/math/rev/mat/functor/map_rect_concurrent.hpp:12,
from C:/R/Library/StanHeaders/include/stan/math/rev/mat.hpp:73,
from C:/R/Library/StanHeaders/include/stan/math.hpp:4,
from C:/R/Library/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file1d54743b5e77.cpp:14:
C:/R/Library/RcppParallel/include/tbb/task.h:1046:101: warning: optimization attribute on ‘void operator delete(void*, const tbb::internal::allocate_additional_child_of_proxy&)’ follows definition but the attribute doesn’t match [-Wattributes]
inline void operator delete( void* task, const tbb::internal::allocate_additional_child_of_proxy& p ) {
^
In file included from C:/R/Library/RcppEigen/include/Eigen/Core:82,
from C:/R/Library/RcppEigen/include/Eigen/Dense:1,
from C:/R/Library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp:13,
from :
C:/rtools40/mingw64/include/c++/8.3.0/new:174:13: note: previous definition of ‘void operator delete(void*, void*)’ was here
inline void operator delete (void*, void*) GLIBCXX_USE_NOEXCEPT { }
^~~~~~~~
file1d54743b5e77.cpp: In member function ‘virtual void model1d5465135f29_ea675482ff536c9af991981f83a71da2_namespace::model1d5465135f29_ea675482ff536c9af991981f83a71da2::transform_inits(const stan::io::var_context&, std::vector&, std::vector&, std::ostream*) const’:
file1d54743b5e77.cpp:100:24: warning: typedef 'local_scalar_t
’ locally defined but not used [-Wunused-local-typedefs]
typedef double local_scalar_t
;
^~~~~~~~~~~~~~~~
In file included from C:/R/Library/StanHeaders/include/stan/math/rev/core.hpp:46,
from C:/R/Library/StanHeaders/include/stan/math/rev/mat.hpp:6,
from C:/R/Library/StanHeaders/include/stan/math.hpp:4,
from C:/R/Library/StanHeaders/include/src/stan/model/model_header.hpp:4,
from file1d54743b5e77.cpp:14:
C:/R/Library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp: At global scope:
C:/R/Library/StanHeaders/include/stan/math/rev/core/set_zero_all_adjoints.hpp:14:13: warning: ‘void stan::math::set_zero_all_adjoints()’ defined but not used [-Wunused-function]
static void set_zero_all_adjoints() {
^~~~~~~~~~~~~~~~~~~~~
C:/rtools40/mingw64/bin/g++ -m64 -shared -s -static-libgcc -o file1d54743b5e77.dll tmp.def file1d54743b5e77.o -LC:/PROGRA~1/R/R-40~1.2/bin/x64 -lR
C:/rtools40/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/8.3.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: file1d54743b5e77.o:file1d54743b5e77.cpp:(.text+0x9e7): 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: file1d54743b5e77.o:file1d54743b5e77.cpp:(.text+0xadc): 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: file1d54743b5e77.o:file1d54743b5e77.cpp:(.text+0xb1e): 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: file1d54743b5e77.o:file1d54743b5e77.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: file1d54743b5e77.o:file1d54743b5e77.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: file1d54743b5e77.o:file1d54743b5e77.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: file1d54743b5e77.o:file1d54743b5e77.cpp:(.text$_ZN4stan4math16ad_tape_observerD1Ev[_ZN4stan4math16ad_tape_observerD1Ev]+0x47): 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

364:
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: file1d54743b5e77.o:file1d54743b5e77.cpp:(.text+0x9e7): 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: file1d54743b5e77.o:file1d54743b5e77.cpp:(.text+0xadc): 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: file1d54743b5e77.o:file1d54743b5e77.cpp:(.text+0xb1e): 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: file1d54743b5e77.o:file1d54743b5e77.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D1Ev[ZN3tbb8internal26task_scheduler
In addition: Warning message:
In file.remove(c(unprocessed, processed)) :
cannot remove file ‘C:\Users\HANS_V~1\AppData\Local\Temp\RtmpEfWCcg\file1d544d4f3181.stan’, reason ‘No such file or directory’
Called from: compileCode(f, code, language = language, verbose = verbose)
Browse[1]> Q

session info ``` - Session info -------------------------------------------------------------------------------------- setting value version R version 4.0.2 (2020-06-22) os Windows 7 x64 SP 1 system x86_64, mingw32 ui RStudio language (EN) collate Dutch_Belgium.1252 ctype Dutch_Belgium.1252 tz Europe/Paris date 2020-07-16
  • Packages ------------------------------------------------------------------------------------------
    ! package * version date lib source
    abind 1.4-5 2016-07-21 [1] CRAN (R 4.0.0)
    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)
    base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.0.0)
    bayesplot 1.7.2 2020-05-28 [1] CRAN (R 4.0.2)
    bridgesampling 1.0-0 2020-02-26 [1] CRAN (R 4.0.0)
    brms * 2.13.3 2020-07-13 [1] CRAN (R 4.0.2)
    Brobdingnag 1.2-6 2018-08-13 [1] CRAN (R 4.0.0)
    callr 3.4.3 2020-03-28 [1] CRAN (R 4.0.0)
    cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.0)
    coda 0.19-3 2019-07-05 [1] CRAN (R 4.0.2)
    codetools 0.2-16 2018-12-24 [2] CRAN (R 4.0.2)
    colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.0)
    colourpicker 1.0 2017-09-27 [1] CRAN (R 4.0.0)
    crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.0)
    crosstalk 1.1.0.1 2020-03-13 [1] CRAN (R 4.0.0)
    curl 4.3 2019-12-02 [1] CRAN (R 4.0.0)
    desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.0)
    devtools 2.3.0 2020-04-10 [1] CRAN (R 4.0.2)
    digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.0)
    dplyr 1.0.0 2020-05-29 [1] CRAN (R 4.0.2)
    DT 0.13 2020-03-23 [1] CRAN (R 4.0.0)
    dygraphs 1.1.1.6 2018-07-11 [1] CRAN (R 4.0.0)
    ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2)
    emmeans 1.4.8 2020-06-26 [1] CRAN (R 4.0.2)
    estimability 1.3 2018-02-11 [1] CRAN (R 4.0.0)
    fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.0)
    fastmap 1.0.1 2019-10-08 [1] CRAN (R 4.0.0)
    fortunes 1.5-4 2016-12-29 [1] CRAN (R 4.0.0)
    fs 1.4.2 2020-06-30 [1] CRAN (R 4.0.2)
    generics 0.0.2 2018-11-29 [1] CRAN (R 4.0.0)
    ggplot2 * 3.3.2 2020-06-19 [1] CRAN (R 4.0.2)
    ggridges 0.5.2 2020-01-12 [1] CRAN (R 4.0.0)
    glue 1.4.1 2020-05-13 [1] CRAN (R 4.0.2)
    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)
    gtools 3.8.2 2020-03-31 [1] CRAN (R 4.0.0)
    htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.2)
    htmlwidgets 1.5.1 2019-10-08 [1] CRAN (R 4.0.0)
    httpuv 1.5.4 2020-06-06 [1] CRAN (R 4.0.2)
    igraph 1.2.5 2020-03-19 [1] CRAN (R 4.0.0)
    inline 0.3.15 2018-05-18 [1] CRAN (R 4.0.0)
    jsonlite 1.7.0 2020-06-25 [1] CRAN (R 4.0.2)
    later 1.1.0.1 2020-06-05 [1] CRAN (R 4.0.2)
    lattice 0.20-41 2020-04-02 [2] CRAN (R 4.0.2)
    lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.0)
    loo 2.3.1 2020-07-14 [1] CRAN (R 4.0.0)
    magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.0)
    markdown 1.1 2019-08-07 [1] CRAN (R 4.0.0)
    MASS 7.3-51.6 2020-04-26 [2] CRAN (R 4.0.2)
    Matrix 1.2-18 2019-11-27 [2] CRAN (R 4.0.2)
    matrixStats 0.56.0 2020-03-13 [1] CRAN (R 4.0.0)
    memoise 1.1.0 2017-04-21 [1] CRAN (R 4.0.0)
    mime 0.9 2020-02-04 [1] CRAN (R 4.0.0)
    miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.0.0)
    multcomp 1.4-13 2020-04-08 [1] CRAN (R 4.0.0)
    munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.0)
    mvtnorm 1.1-1 2020-06-09 [1] CRAN (R 4.0.0)
    nlme 3.1-148 2020-05-24 [1] CRAN (R 4.0.2)
    packrat 0.5.0 2018-11-14 [1] CRAN (R 4.0.0)
    pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.0)
    pkgbuild 1.1.0 2020-07-13 [1] CRAN (R 4.0.0)
    pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.0)
    pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.2)
    plyr 1.8.6 2020-03-03 [1] CRAN (R 4.0.0)
    prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.0)
    processx 3.4.3 2020-07-05 [1] CRAN (R 4.0.2)
    promises 1.1.1 2020-06-09 [1] CRAN (R 4.0.2)
    ps 1.3.3 2020-05-08 [1] CRAN (R 4.0.2)
    purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.0)
    R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.0)
    Rcpp * 1.0.5 2020-07-06 [1] CRAN (R 4.0.2)
    D RcppParallel 5.0.2 2020-06-24 [1] CRAN (R 4.0.2)
    remotes 2.1.1 2020-02-15 [1] CRAN (R 4.0.0)
    reshape2 1.4.4 2020-04-09 [1] CRAN (R 4.0.0)
    rlang 0.4.6 2020-05-02 [1] CRAN (R 4.0.2)
    rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.0)
    rsconnect 0.8.16 2019-12-13 [1] CRAN (R 4.0.0)
    rstan * 2.21.1 2020-07-08 [1] CRAN (R 4.0.2)
    rstantools 2.1.1 2020-07-06 [1] CRAN (R 4.0.2)
    rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.0)
    sandwich 2.5-1 2019-04-06 [1] CRAN (R 4.0.0)
    scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.2)
    sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.0)
    shiny 1.5.0 2020-06-23 [1] CRAN (R 4.0.2)
    shinyjs 1.1 2020-01-13 [1] CRAN (R 4.0.0)
    shinystan 2.5.0 2018-05-01 [1] CRAN (R 4.0.0)
    shinythemes 1.1.2 2018-11-06 [1] CRAN (R 4.0.0)
    StanHeaders * 2.21.0-5 2020-06-09 [1] CRAN (R 4.0.2)
    stringi 1.4.6 2020-02-17 [1] CRAN (R 4.0.0)
    stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.0)
    survival 3.2-3 2020-06-13 [1] CRAN (R 4.0.2)
    testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.0)
    TH.data 1.0-10 2019-01-21 [1] CRAN (R 4.0.0)
    threejs 0.3.3 2020-01-21 [1] CRAN (R 4.0.0)
    tibble 3.0.2 2020-07-07 [1] CRAN (R 4.0.2)
    tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.2)
    usethis 1.6.1 2020-04-29 [1] CRAN (R 4.0.0)
    V8 3.2.0 2020-06-19 [1] CRAN (R 4.0.2)
    vctrs 0.3.1 2020-06-05 [1] CRAN (R 4.0.2)
    withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.0)
    xtable 1.8-4 2019-04-21 [1] CRAN (R 4.0.0)
    xts 0.12-0 2020-01-19 [1] CRAN (R 4.0.0)
    zoo 1.8-8 2020-05-02 [1] CRAN (R 4.0.2)

[1] C:/R/Library
[2] C:/Program Files/R/R-4.0.2/library

D – DLL MD5 mismatch, broken installation.

</details>

Can you try

I just did that

My Makevar.win looks like this

CXX14FLAGS += -mtune=native -Wno-ignored-attributes -Wno-deprecated-declarations

CXX14FLAGS=-O3 -mtune=native

CXX11FLAGS=-O3 -march=corei7 -mtune=corei7

CXX14FLAGS=-O3 -mtune=native

CXX11FLAGS=-O3 -march=corei7 -mtune=corei7

packageVersion(“rstan”)

[1] ‘2.21.1’

packageVersion(“StanHeaders”)

[1] ‘2.21.0.6’

Getting this error

The NEXT version of Stan will not be able to pre-process your Stan program.

Please open an issue at

if you can share or at least describe your Stan program. This will help ensure that Stan

continues to work on your Stan programs in the future. Thank you!

This message can be avoided by wrapping your function call inside suppressMessages().

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: file7fc55cd8f4.o:file7fc55cd8f4.cpp:(.text+0x11fc): 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: file7fc55cd8f4.o:file7fc55cd8f4.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: file7fc55cd8f4.o:file7fc55cd8f4.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-m

In addition: Warning message:

In file.remove(c(unprocessed, processed)) :

cannot remove file ‘C:\Users\johnson.rd.1\AppData\Local\Temp\2\RtmpWS3h8Y\file7fc681c587b.stan’, reason ‘No such file or directory’

Error in sink(type = “output”) : invalid connection

image001.png

That should say 2.21.2 if

worked correctly.

This new

packageVersion(“rstan”)

[1] ‘2.21.2’

packageVersion(“StanHeaders”)

[1] ‘2.21.0.6’

CXX14FLAGS += -mtune=native -Wno-ignored-attributes -Wno-deprecated-declarations

CXX14FLAGS=-O3 -mtune=native

CXX11FLAGS=-O3 -march=corei7 -mtune=corei7

CXX14FLAGS=-O3 -mtune=native -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2

CXX11FLAGS=-O3 -march=corei7 -mtune=corei7

Error in compileCode(f, code, language = language, verbose = verbose) :

Compilation ERROR, function(s)/method(s) not created! g++.exe: error: C:/Program: No such file or directory

g++.exe: error: Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a: No such file or directory

In addition: Warning message:

In file.remove(c(unprocessed, processed)) :

cannot remove file ‘C:\Users\johnson.rd.1\AppData\Local\Temp\2\Rtmpk5Nrj7\file85c494f2b41.stan’, reason ‘No such file or directory’

Error in sink(type = “output”) : invalid connection

image001.png

And rstan:::rstanplugin()?

With

  • .Rprofile and .Renviron empty
  • Makevars.win deleted
    the results of running example (…) and stan(“eightscools”…) remain the same, although I do not get an “Error:”

Compilation argument:
C:/R/R-40~1.2/bin/x64/R CMD SHLIB file3da859342131.cpp 2> file3da859342131.cpp.err.txt
Error in file(con, “r”) : cannot open the connection
In addition: Warning messages:
1: In file.remove(c(unprocessed, processed)) :
cannot remove file ‘C:\Users\myusername\AppData\Local\Temp\RtmpyQj4iA\file3da8669c725e.stan’, reason ‘No such file or directory’
2: In file(con, “r”) :
cannot open file ‘file3da859342131.cpp.err.txt’: No such file or directory

Looking into the temp folder I’ve noticed that the cpp file, in this example, file3da859342131.cpp, is actually created, so the compilation process seems to fail somewhere after this point…

don’t know if this observation is of any help though…
br/

If you call stan with verbose = TRUE, we can pinpoint where the compilation failed.

rstan:::rstanplugin()

$includes

[1] “// [[Rcpp::plugins(cpp14)]]\n”

$body

function (x)

x

<bytecode: 0x00000218ee9f4000>

<environment: 0x00000218ee9f3cf0>

$env

$env$LOCAL_LIBS

[1] " C:/Program Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a -L"C:/Program Files/R/R-4.0.2/library/StanHeaders/libs/x64" -lStanHeaders -L"C:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64" -ltbb"

$env$PKG_CPPFLAGS

[1] " -I"C:/Program Files/R/R-4.0.2/library/Rcpp/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppEigen/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppEigen/include/unsupported" -I"C:/Program Files/R/R-4.0.2/library/BH/include" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/src/" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppParallel/include/" -I"C:/Program Files/R/R-4.0.2/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include “C:/Program Files/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp” -std=c++1y"

image001.png

This is what I got from using verbose=TRUE

C:/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o file19a02b6e78fe.dll tmp.def file19a02b6e78fe.o C:/Program Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a -LC:/Program Files/R/R-4.0.2/library/StanHeaders/libs/x64 -lStanHeaders -LC:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64 -ltbb -LC:/PROGRA~1/R/R-4.0.2/bin/x64 -lR

g++.exe: error: C:/Program: No such file or directory

g++.exe: error: Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a: No such file or directory

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 model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_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”, “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”);

32: reader.add_event(20, 18, “end”, “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”);

33: return reader;

34: }

35:

36: class model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6

37: : public stan::model::model_base_crtp<model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6> {

38: private:

39: int J;

40: std::vector y;

41: std::vector sigma;

42: public:

43: model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6(rstan::io::rlist_ref_var_context& context__,

44: std::ostream* pstream__ = 0)

45: : model_base_crtp(0) {

46: ctor_body(context__, 0, pstream__);

47: }

48:

49: model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6(stan::io::var_context& context__,

50: unsigned int random_seed__,

51: std::ostream* pstream__ = 0)

52: : model_base_crtp(0) {

53: ctor_body(context__, random_seed__, pstream__);

54: }

55:

56: void ctor_body(stan::io::var_context& context__,

57: unsigned int random_seed__,

58: std::ostream* pstream__) {

59: typedef double local_scalar_t__;

60:

61: boost::ecuyer1988 base_rng__ =

62: stan::services::util::create_rng(random_seed__, 0);

63: (void) base_rng__; // suppress unused var warning

64:

65: current_statement_begin__ = -1;

66:

67: static const char* function__ = “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_namespace::model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”;

68: (void) function__; // dummy to suppress unused var warning

69: size_t pos__;

70: (void) pos__; // dummy to suppress unused var warning

71: std::vector vals_i__;

72: std::vector vals_r__;

73: local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());

74: (void) DUMMY_VAR__; // suppress unused var warning

75:

76: try {

77: // initialize data block variables from context__

78: current_statement_begin__ = 3;

79: context__.validate_dims(“data initialization”, “J”, “int”, context__.to_vec());

80: J = int(0);

81: vals_i__ = context__.vals_i(“J”);

82: pos__ = 0;

83: J = vals_i__[pos__++];

84: check_greater_or_equal(function__, “J”, J, 0);

85:

86: current_statement_begin__ = 4;

87: validate_non_negative_index(“y”, “J”, J);

88: context__.validate_dims(“data initialization”, “y”, “double”, context__.to_vec(J));

89: y = std::vector(J, double(0));

90: vals_r__ = context__.vals_r(“y”);

91: pos__ = 0;

92: size_t y_k_0_max__ = J;

93: for (size_t k_0__ = 0; k_0__ < y_k_0_max__; ++k_0__) {

94: y[k_0__] = vals_r__[pos__++];

95: }

96:

97: current_statement_begin__ = 5;

98: validate_non_negative_index(“sigma”, “J”, J);

99: context__.validate_dims(“data initialization”, “sigma”, “double”, context__.to_vec(J));

100: sigma = std::vector(J, double(0));

101: vals_r__ = context__.vals_r(“sigma”);

102: pos__ = 0;

103: size_t sigma_k_0_max__ = J;

104: for (size_t k_0__ = 0; k_0__ < sigma_k_0_max__; ++k_0__) {

105: sigma[k_0__] = vals_r__[pos__++];

106: }

107: size_t sigma_i_0_max__ = J;

108: for (size_t i_0__ = 0; i_0__ < sigma_i_0_max__; ++i_0__) {

109: check_greater_or_equal(function__, “sigma[i_0__]”, sigma[i_0__], 0);

110: }

111:

112:

113: // initialize transformed data variables

114: // execute transformed data statements

115:

116: // validate transformed data

117:

118: // validate, set parameter ranges

119: num_params_r__ = 0U;

120: param_ranges_i__.clear();

121: current_statement_begin__ = 8;

122: num_params_r__ += 1;

123: current_statement_begin__ = 9;

124: num_params_r__ += 1;

125: current_statement_begin__ = 10;

126: validate_non_negative_index(“eta”, “J”, J);

127: num_params_r__ += J;

128: } catch (const std::exception& e) {

129: stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());

130: // Next line prevents compiler griping about no return

131: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");

132: }

133: }

134:

135: ~model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6() { }

136:

137:

138: void transform_inits(const stan::io::var_context& context__,

139: std::vector& params_i__,

140: std::vector& params_r__,

141: std::ostream* pstream__) const {

142: typedef double local_scalar_t__;

143: stan::io::writer writer__(params_r__, params_i__);

144: size_t pos__;

145: (void) pos__; // dummy call to supress warning

146: std::vector vals_r__;

147: std::vector vals_i__;

148:

149: current_statement_begin__ = 8;

150: if (!(context__.contains_r(“mu”)))

151: stan::lang::rethrow_located(std::runtime_error(std::string(“Variable mu missing”)), current_statement_begin__, prog_reader__());

152: vals_r__ = context__.vals_r(“mu”);

153: pos__ = 0U;

154: context__.validate_dims(“parameter initialization”, “mu”, “double”, context__.to_vec());

155: double mu(0);

156: mu = vals_r__[pos__++];

157: try {

158: writer__.scalar_unconstrain(mu);

159: } catch (const std::exception& e) {

160: stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable mu: ") + e.what()), current_statement_begin__, prog_reader__());

161: }

162:

163: current_statement_begin__ = 9;

164: if (!(context__.contains_r(“tau”)))

165: stan::lang::rethrow_located(std::runtime_error(std::string(“Variable tau missing”)), current_statement_begin__, prog_reader__());

166: vals_r__ = context__.vals_r(“tau”);

167: pos__ = 0U;

168: context__.validate_dims(“parameter initialization”, “tau”, “double”, context__.to_vec());

169: double tau(0);

170: tau = vals_r__[pos__++];

171: try {

172: writer__.scalar_lb_unconstrain(0, tau);

173: } catch (const std::exception& e) {

174: stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable tau: ") + e.what()), current_statement_begin__, prog_reader__());

175: }

176:

177: current_statement_begin__ = 10;

178: if (!(context__.contains_r(“eta”)))

179: stan::lang::rethrow_located(std::runtime_error(std::string(“Variable eta missing”)), current_statement_begin__, prog_reader__());

180: vals_r__ = context__.vals_r(“eta”);

181: pos__ = 0U;

182: validate_non_negative_index(“eta”, “J”, J);

183: context__.validate_dims(“parameter initialization”, “eta”, “vector_d”, context__.to_vec(J));

184: Eigen::Matrix<double, Eigen::Dynamic, 1> eta(J);

185: size_t eta_j_1_max__ = J;

186: for (size_t j_1__ = 0; j_1__ < eta_j_1_max__; ++j_1__) {

187: eta(j_1__) = vals_r__[pos__++];

188: }

189: try {

190: writer__.vector_unconstrain(eta);

191: } catch (const std::exception& e) {

192: stan::lang::rethrow_located(std::runtime_error(std::string("Error transforming variable eta: ") + e.what()), current_statement_begin__, prog_reader__());

193: }

194:

195: params_r__ = writer__.data_r();

196: params_i__ = writer__.data_i();

197: }

198:

199: void transform_inits(const stan::io::var_context& context,

200: Eigen::Matrix<double, Eigen::Dynamic, 1>& params_r,

201: std::ostream* pstream__) const {

202: std::vector params_r_vec;

203: std::vector params_i_vec;

204: transform_inits(context, params_i_vec, params_r_vec, pstream__);

205: params_r.resize(params_r_vec.size());

206: for (int i = 0; i < params_r.size(); ++i)

207: params_r(i) = params_r_vec[i];

208: }

209:

210:

211: template <bool propto__, bool jacobian__, typename T__>

212: T__ log_prob(std::vector<T__>& params_r__,

213: std::vector& params_i__,

214: std::ostream* pstream__ = 0) const {

215:

216: typedef T__ local_scalar_t__;

217:

218: local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());

219: (void) DUMMY_VAR__; // dummy to suppress unused var warning

220:

221: T__ lp__(0.0);

222: stan::math::accumulator<T__> lp_accum__;

223: try {

224: stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);

225:

226: // model parameters

227: current_statement_begin__ = 8;

228: local_scalar_t__ mu;

229: (void) mu; // dummy to suppress unused var warning

230: if (jacobian__)

231: mu = in__.scalar_constrain(lp__);

232: else

233: mu = in__.scalar_constrain();

234:

235: current_statement_begin__ = 9;

236: local_scalar_t__ tau;

237: (void) tau; // dummy to suppress unused var warning

238: if (jacobian__)

239: tau = in__.scalar_lb_constrain(0, lp__);

240: else

241: tau = in__.scalar_lb_constrain(0);

242:

243: current_statement_begin__ = 10;

244: Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> eta;

245: (void) eta; // dummy to suppress unused var warning

246: if (jacobian__)

247: eta = in__.vector_constrain(J, lp__);

248: else

249: eta = in__.vector_constrain(J);

250:

251: // transformed parameters

252: current_statement_begin__ = 13;

253: validate_non_negative_index(“theta”, “J”, J);

254: Eigen::Matrix<local_scalar_t__, Eigen::Dynamic, 1> theta(J);

255: stan::math::initialize(theta, DUMMY_VAR__);

256: stan::math::fill(theta, DUMMY_VAR__);

257: stan::math::assign(theta,add(mu, multiply(tau, eta)));

258:

259: // validate transformed parameters

260: const char* function__ = “validate transformed params”;

261: (void) function__; // dummy to suppress unused var warning

262:

263: current_statement_begin__ = 13;

264: size_t theta_j_1_max__ = J;

265: for (size_t j_1__ = 0; j_1__ < theta_j_1_max__; ++j_1__) {

266: if (stan::math::is_uninitialized(theta(j_1__))) {

267: std::stringstream msg__;

268: msg__ << “Undefined transformed parameter: theta” << “(” << j_1__ << “)”;

269: stan::lang::rethrow_located(std::runtime_error(std::string("Error initializing variable theta: ") + msg__.str()), current_statement_begin__, prog_reader__());

270: }

271: }

272:

273: // model body

274:

275: current_statement_begin__ = 16;

276: lp_accum__.add(normal_log(eta, 0, 1));

277: current_statement_begin__ = 17;

278: lp_accum__.add(normal_log(y, theta, sigma));

279:

280: } catch (const std::exception& e) {

281: stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());

282: // Next line prevents compiler griping about no return

283: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");

284: }

285:

286: lp_accum__.add(lp__);

287: return lp_accum__.sum();

288:

289: } // log_prob()

290:

291: template <bool propto, bool jacobian, typename T_>

292: T_ log_prob(Eigen::Matrix<T_,Eigen::Dynamic,1>& params_r,

293: std::ostream* pstream = 0) const {

294: std::vector<T_> vec_params_r;

295: vec_params_r.reserve(params_r.size());

296: for (int i = 0; i < params_r.size(); ++i)

297: vec_params_r.push_back(params_r(i));

298: std::vector vec_params_i;

299: return log_prob<propto,jacobian,T_>(vec_params_r, vec_params_i, pstream);

300: }

301:

302:

303: void get_param_names(std::vectorstd::string& names__) const {

304: names__.resize(0);

305: names__.push_back(“mu”);

306: names__.push_back(“tau”);

307: names__.push_back(“eta”);

308: names__.push_back(“theta”);

309: }

310:

311:

312: void get_dims(std::vector<std::vector<size_t> >& dimss__) const {

313: dimss__.resize(0);

314: std::vector<size_t> dims__;

315: dims__.resize(0);

316: dimss__.push_back(dims__);

317: dims__.resize(0);

318: dimss__.push_back(dims__);

319: dims__.resize(0);

320: dims__.push_back(J);

321: dimss__.push_back(dims__);

322: dims__.resize(0);

323: dims__.push_back(J);

324: dimss__.push_back(dims__);

325: }

326:

327: template

328: void write_array(RNG& base_rng__,

329: std::vector& params_r__,

330: std::vector& params_i__,

331: std::vector& vars__,

332: bool include_tparams__ = true,

333: bool include_gqs__ = true,

334: std::ostream* pstream__ = 0) const {

335: typedef double local_scalar_t__;

336:

337: vars__.resize(0);

338: stan::io::reader<local_scalar_t__> in__(params_r__, params_i__);

339: static const char* function__ = “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_namespace::write_array”;

340: (void) function__; // dummy to suppress unused var warning

341:

342: // read-transform, write parameters

343: double mu = in__.scalar_constrain();

344: vars__.push_back(mu);

345:

346: double tau = in__.scalar_lb_constrain(0);

347: vars__.push_back(tau);

348:

349: Eigen::Matrix<double, Eigen::Dynamic, 1> eta = in__.vector_constrain(J);

350: size_t eta_j_1_max__ = J;

351: for (size_t j_1__ = 0; j_1__ < eta_j_1_max__; ++j_1__) {

352: vars__.push_back(eta(j_1__));

353: }

354:

355: double lp__ = 0.0;

356: (void) lp__; // dummy to suppress unused var warning

357: stan::math::accumulator lp_accum__;

358:

359: local_scalar_t__ DUMMY_VAR__(std::numeric_limits::quiet_NaN());

360: (void) DUMMY_VAR__; // suppress unused var warning

361:

362: if (!include_tparams__ && !include_gqs__) return;

363:

364: try {

365: // declare and define transformed parameters

366: current_statement_begin__ = 13;

367: validate_non_negative_index(“theta”, “J”, J);

368: Eigen::Matrix<double, Eigen::Dynamic, 1> theta(J);

369: stan::math::initialize(theta, DUMMY_VAR__);

370: stan::math::fill(theta, DUMMY_VAR__);

371: stan::math::assign(theta,add(mu, multiply(tau, eta)));

372:

373: if (!include_gqs__ && !include_tparams__) return;

374: // validate transformed parameters

375: const char* function__ = “validate transformed params”;

376: (void) function__; // dummy to suppress unused var warning

377:

378: // write transformed parameters

379: if (include_tparams__) {

380: size_t theta_j_1_max__ = J;

381: for (size_t j_1__ = 0; j_1__ < theta_j_1_max__; ++j_1__) {

382: vars__.push_back(theta(j_1__));

383: }

384: }

385: if (!include_gqs__) return;

386: } catch (const std::exception& e) {

387: stan::lang::rethrow_located(e, current_statement_begin__, prog_reader__());

388: // Next line prevents compiler griping about no return

389: throw std::runtime_error("*** IF YOU SEE THIS, PLEASE REPORT A BUG ***");

390: }

391: }

392:

393: template

394: void write_array(RNG& base_rng,

395: Eigen::Matrix<double,Eigen::Dynamic,1>& params_r,

396: Eigen::Matrix<double,Eigen::Dynamic,1>& vars,

397: bool include_tparams = true,

398: bool include_gqs = true,

399: std::ostream* pstream = 0) const {

400: std::vector params_r_vec(params_r.size());

401: for (int i = 0; i < params_r.size(); ++i)

402: params_r_vec[i] = params_r(i);

403: std::vector vars_vec;

404: std::vector params_i_vec;

405: write_array(base_rng, params_r_vec, params_i_vec, vars_vec, include_tparams, include_gqs, pstream);

406: vars.resize(vars_vec.size());

407: for (int i = 0; i < vars.size(); ++i)

408: vars(i) = vars_vec[i];

409: }

410:

411: std::string model_name() const {

412: return “model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”;

413: }

414:

415:

416: void constrained_param_names(std::vectorstd::string& param_names__,

417: bool include_tparams__ = true,

418: bool include_gqs__ = true) const {

419: std::stringstream param_name_stream__;

420: param_name_stream__.str(std::string());

421: param_name_stream__ << “mu”;

422: param_names__.push_back(param_name_stream__.str());

423: param_name_stream__.str(std::string());

424: param_name_stream__ << “tau”;

425: param_names__.push_back(param_name_stream__.str());

426: size_t eta_j_1_max__ = J;

427: for (size_t j_1__ = 0; j_1__ < eta_j_1_max__; ++j_1__) {

428: param_name_stream__.str(std::string());

429: param_name_stream__ << “eta” << ‘.’ << j_1__ + 1;

430: param_names__.push_back(param_name_stream__.str());

431: }

432:

433: if (!include_gqs__ && !include_tparams__) return;

434:

435: if (include_tparams__) {

436: size_t theta_j_1_max__ = J;

437: for (size_t j_1__ = 0; j_1__ < theta_j_1_max__; ++j_1__) {

438: param_name_stream__.str(std::string());

439: param_name_stream__ << “theta” << ‘.’ << j_1__ + 1;

440: param_names__.push_back(param_name_stream__.str());

441: }

442: }

443:

444: if (!include_gqs__) return;

445: }

446:

447:

448: void unconstrained_param_names(std::vectorstd::string& param_names__,

449: bool include_tparams__ = true,

450: bool include_gqs__ = true) const {

451: std::stringstream param_name_stream__;

452: param_name_stream__.str(std::string());

453: param_name_stream__ << “mu”;

454: param_names__.push_back(param_name_stream__.str());

455: param_name_stream__.str(std::string());

456: param_name_stream__ << “tau”;

457: param_names__.push_back(param_name_stream__.str());

458: size_t eta_j_1_max__ = J;

459: for (size_t j_1__ = 0; j_1__ < eta_j_1_max__; ++j_1__) {

460: param_name_stream__.str(std::string());

461: param_name_stream__ << “eta” << ‘.’ << j_1__ + 1;

462: param_names__.push_back(param_name_stream__.str());

463: }

464:

465: if (!include_gqs__ && !include_tparams__) return;

466:

467: if (include_tparams__) {

468: size_t theta_j_1_max__ = J;

469: for (size_t j_1__ = 0; j_1__ < theta_j_1_max__; ++j_1__) {

470: param_name_stream__.str(std::string());

471: param_name_stream__ << “theta” << ‘.’ << j_1__ + 1;

472: param_names__.push_back(param_name_stream__.str());

473: }

474: }

475:

476: if (!include_gqs__) return;

477: }

478:

479: }; // model

480:

481: } // namespace

482:

483: typedef model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_namespace::model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6 stan_model;

484:

485: #ifndef USING_R

486:

487: stan::model::model_base& new_model(

488: stan::io::var_context& data_context,

489: unsigned int seed,

490: std::ostream* msg_stream) {

491: stan_model* m = new stan_model(data_context, seed, msg_stream);

492: return *m;

493: }

494:

495: #endif

496:

497:

498:

499: #include <rstan_next/stan_fit.hpp>

500:

501: struct stan_model_holder {

502: stan_model_holder(rstan::io::rlist_ref_var_context rcontext,

503: unsigned int random_seed)

504: : rcontext_(rcontext), random_seed_(random_seed)

505: {

506: }

507:

508: //stan::math::ChainableStack ad_stack;

509: rstan::io::rlist_ref_var_context rcontext_;

510: unsigned int random_seed_;

511: };

512:

513: Rcpp::XPtrstan::model::model_base model_ptr(stan_model_holder* smh) {

514: Rcpp::XPtrstan::model::model_base model_instance(new stan_model(smh->rcontext_, smh->random_seed_), true);

515: return model_instance;

516: }

517:

518: Rcpp::XPtrrstan::stan_fit_base fit_ptr(stan_model_holder* smh) {

519: return Rcpp::XPtrrstan::stan_fit_base(new rstan::stan_fit(model_ptr(smh), smh->random_seed_), true);

520: }

521:

522: std::string model_name(stan_model_holder* smh) {

523: return model_ptr(smh).get()->model_name();

524: }

525:

526: RCPP_MODULE(stan_fit4model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6_mod){

527: Rcpp::class_<stan_model_holder>(“stan_fit4model19a0346441bd_1f2a554aa3b5655c1d7823c366b9bef6”)

528: .constructor<rstan::io::rlist_ref_var_context, unsigned int>()

529: .method(“model_ptr”, &model_ptr)

530: .method(“fit_ptr”, &fit_ptr)

531: .method(“model_name”, &model_name)

532: ;

533: }

534:

535:

536: // declarations

537: extern “C” {

538: SEXP file19a02b6e78fe( ) ;

539: }

540:

541: // definition

542:

543: SEXP file19a02b6e78fe( ){

544: return Rcpp::wrap(“1f2a554aa3b5655c1d7823c366b9bef6”);

545: }

546:

547:

Error in compileCode(f, code, language = language, verbose = verbose) :

Compilation ERROR, function(s)/method(s) not created! g++.exe: error: C:/Program: No such file or directory

g++.exe: error: Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a: No such file or directory

In addition: Warning message:

In file.remove(c(unprocessed, processed)) :

cannot remove file ‘C:\Users\johnson.rd.1\AppData\Local\Temp\2\RtmpC0RewG\file19a07a592db9.stan’, reason ‘No such file or directory’

image001.png

I have been running with verbose = TRUE, but a “new user” I’m seemingly running into the max 5 posts limit when trying to post the 500+ lines output of the stan(eightscools) output…

It’s okay. There is enough information for me to fix it.

1 Like

Was this issue fixed? I’m brand new with rstan and I’m having this same problem with my install (error with space in “Program FIles” in the include of Eigen.hpp) . Also brand new here in the forums, and as far as I can tell this trail went cold 7 days ago?

Oh, the trail is still hot. It’s just on

Ben do we need to wrap everywhere rstan uses file paths with file.path()?

Ideally

Alright I’ll try to take a look today

We would have probably already tripped over anything that wasn’t in the makevars PR. Should we also avoid -mtune=native?