Brm does not run with latest RStudio version

Hi,
I have upgraded to the latest RStudio version and a model I ran before gives now errors??

RStudio 2022.07.0+548 “Spotted Wakerobin” Release (34ea3031089fa4e38738a9256d6fa6d70629c822, 2022-07-06) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36

model <- brm(formula = base_sign_test ~ journorder + cont_aut+year,  
+                           data=base, 
+                           family = bernoulli(link = "logit"),
+                           prior=prior1,
+                           warmup = 500, 
+                           iter = 10000, 
+                           chains = 4, 
+                           init= "0", 
+                           cores=2,
+                           seed = 123,
+                           thin=5)
Compiling Stan program...
make cmd is
  make -f "C:/PROGRA~1/R/R-42~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-42~1.1/share/make/winshlib.mk" CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB="fileaa60680b6a.dll" WIN=64 TCLBIN= OBJECTS="fileaa60680b6a.o"

make would use
if test "zfileaa60680b6a.o" != "z"; then \
  if test -e "fileaa60680b6a-win.def"; then \
    echo g++  -shared -s -static-libgcc -o fileaa60680b6a.dll fileaa60680b6a-win.def fileaa60680b6a.o  -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.1/bin/x64" -lR ; \
    g++  -shared -s -static-libgcc -o fileaa60680b6a.dll fileaa60680b6a-win.def fileaa60680b6a.o  -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.1/bin/x64" -lR ; \
  else \
    echo EXPORTS > tmp.def; \
    nm fileaa60680b6a.o | sed -n 's/^.* [BCDRT] / /p' | sed -e '/[.]refptr[.]/d' -e '/[.]weak[.]/d' | sed 's/[^ ][^ ]*/"&"/g'  >> tmp.def; \
    echo g++  -shared -s -static-libgcc -o fileaa60680b6a.dll tmp.def fileaa60680b6a.o  -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.1/bin/x64" -lR ; \
    g++  -shared -s -static-libgcc -o fileaa60680b6a.dll tmp.def fileaa60680b6a.o  -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64" -L"c:/rtools42/x86_64-w64-mingw32.static.posix/lib"  -L"C:/PROGRA~1/R/R-42~1.1/bin/x64" -lR ; \
    rm -f tmp.def; \
  fi \
fi
Error in compileCode(f, code, language = language, verbose = verbose) : 
  C:/RBuildTools/4.0/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: fileaa60680b6a.o:fileaa60680b6a.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D0Ev[_ZN3tbb8internal26task_scheduler_observer_v3D0Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/RBuildTools/4.0/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: fileaa60680b6a.o:fileaa60680b6a.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x1d): undefined reference to `tbb::internal::task_scheduler_observer_v3::observe(bool)'C:/RBuildTools/4.0/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: fileaa60680b6a.o:fileaa60680b6a.cpp:(.text$_ZN3tbb10interface623task_scheduler_observerD1Ev[_ZN3tbb10interface623task_scheduler_observerD1Ev]+0x3a): undefined reference to `tbb::internal::task_schedule
Error in sink(type = "output") : invalid connection
> 

Any suggestions?
Thank you,
Nikos

You need to update your rstan package to the preview version via:

remove.packages(c("StanHeaders", "rstan"))
install.packages("StanHeaders", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))
install.packages("rstan", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

It works!
Many thanks
Nikos

1 Like

Thank you!!! I have been struggling with this for the last week!