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

Failed for me also

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: file23c45abf7953.o:file23c45abf7953.cpp:(.text+0x15fc): 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: file23c45abf7953.o:file23c45abf7953.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: file23c45abf7953.o:file23c45abf7953.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/

In addition: Warning message:

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

cannot remove file ‘C:\Users\johnson.rd.1\AppData\Local\Temp\3\Rtmpei0UR2\file23c48b83ec3.stan’, reason ‘No such file or directory’

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

image001.png

1 Like

I’m getting the same set of errors and have pretty much the same build. StanHeaders is saved in a directory without spaces.

2 Likes

I am running R version 4.0.2 and Rtools 4.0 with Windows 10.
I updated rstan to 2.21.2 and StanHeaders to 2.21.0-6 per suggestions above from @bgoodri .

I can run the following code:
example(stan_model, package = “rstan”, run.dontrun = TRUE)

Then when I go slightly off-piste and run the schools example as follows, R completely crashes every time…tried re-booting a couple of times…

schools_data <- list(J = 8, y = c(28, 8, -3, 7, -1, 1, 18, 12),
sigma = c(15, 10, 16, 11, 9, 11, 10, 18))

#I created the file “schools.stan” file locally by just copy-and-paste from vignette

fit1 <- stan(
file = “schools.stan”, # Stan program
data = schools_data, # named list of data
chains = 4, # number of Markov chains
warmup = 1000, # number of warmup iterations per chain
iter = 2000, # total number of iterations per chain
cores = 1, # number of cores (could use one per chain)
refresh = 0 # no progress shown
)

Any help greatly appreciated!

I am getting the same warning and error messages. I did a reinstall of R and rstan, but it persists. R 4.0.2, rstan 2.21.1, Rtools 4.0, Windows 10.

This happens with any Stan model I have saved that worked previously and also when running example(stan_model, package = “rstan”, run.dontrun = TRUE).

It also happens both with StanHeaders 2.21.0-5 and after installing StanHeaders 2.21.0-6.

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().

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: file6d8811b23ffc.o:file6d8811b23ffc.cpp:(.text+0x124c): 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: file6d8811b23ffc.o:file6d8811b23ffc.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: file6d8811b23ffc.o:file6d8811b23ffc.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
In addition: Warning message:
In file.remove(c(unprocessed, processed)) :
cannot remove file ‘C:\Users\rbres\AppData\Local\Temp\RtmpKMKeOM\file6d88ff72c10.stan’, reason ‘No such file or directory’

An update on my current hack workaround. I am compiling Stan models by inserting a Stan code chunk within a markdown file. Then I can actually see the errors to troubleshoot my models.

This avoids the issues compiling a Stan model using stan_model() .
I just was able to compile a stan model using stan_model() that I knew should work using my hack.
But I still get this warning below:

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().
cannot remove file ‘C:\Users\kirvine\AppData\Local\Temp\1\RtmpWyOVVx\filecf842083ef2.stan’, reason ‘No such file or directory’

Hold on. I’m going to try to build some more provisional binary packages.

2 Likes

I have a similar issue with Ubuntu 18.04. I have rstan 2.21.2 and StanHeaders 2.21.0-5. The “example” function works but when I run the schools example, it compiles, starts sampling and then crashes R without an error.

Do you have -march=native -mtune=native or similar in the Makevars file?

I extended the Makevars file t o the following but it still crashes:

CXX14FLAGS=-O3 -march=native -mtune=native -fPIC CXX14=g++ -march=native -mtune=native

Sorry, my response got messed. up… Yes, my makevars file is the following but the 8 schools stan model still crashes:

CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX14=g++

Try taking the -march=native -mtune=native out of CXX14FLAGS.

It is still crashing. I have tried both installing from Cran and github developer. No error messages provided.

I’m having similar issues with a brand new install

My setup:
Win 10, 32 GB memory
R version 4.0.2 (2020-06-22) – “Taking Off Again”
Platform: x86_64-w64-mingw32/x64 (64-bit)
Rtools 4.0
rstan Version 2.21.1, GitRev: 2e1f913d3ca3

Originally installed R per default under C:\Program files
Then removed that install and reinstalled directly under c:\R to avoid white space issue

executing:

  1. example(stan_model, package = ‘rstan’, run.dontrun = TRUE), with an empty environment
  2. stan() with eight schools, reading model from .stan file or from environment
  3. stan() rats reading model from .stan file
    …all terminate with a error message like this:

Compilation argument:
C:/R/R-40~1.2/bin/x64/R CMD SHLIB file2bc83ff26d76.cpp 2> file2bc83ff26d76.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\Rtmp4iYFPO\file2bc85c694a01.stan’, reason ‘No such file or directory’
2: In file(con, “r”) :
cannot open file ‘file2bc83ff26d76.cpp.err.txt’: No such file or directory

Have installed rstan from binary, from source, in released and development versions… the behavior remains the same.

my Makevars.win currently contains:

CXX14=$(BINPREF)g++ -O2 -march=native -mtune=native -m$(WIN) -std=c++1y
CXX11FLAGS=-O3 -march=corei7 -mtune=corei7

… have tried a bunch of settings here also, with no effect

besides setting verbose = TRUE in the stan() or stan_model() calls, is there any way to pin down what causes the compilation to fail ?

br/

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