Error in compileCode(f, code, language = language, verbose = verbose) & 'No such file or directory' error

Hi, I am pretty new to Stan. I have been trying to run the schools.stan model example, but I am always getting a list of Errors. Similar issues in the forums have not been helpful for me yet.

These are my software versions:
Windows 10
RStan version: 2.21.1
StanHeaders: 2.21.0-5
RStudio version: 4.0.2
RTools version: 4.0.0.28

When I run:
example(stan_model, run.dontrun = TRUE)

I get this output:
Fehler 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: file37c24084fd5.o:file37c24084fd5.cpp:(.text+0x71c): 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: file37c24084fd5.o:file37c24084fd5.cpp:(.text+0x1317): 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: file37c24084fd5.o:file37c24084fd5.cpp:(.text+0x75e): 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: file37c24084fd5.o:file37c24084fd5.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D1Ev[_ZN3tbb8internal26task_scheduler_observ
Zusätzlich: Warnmeldung:
In file.remove(c(unprocessed, processed)) :
kann Datei ‘C:\Users\tibor\AppData\Local\Temp\Rtmpsh0PnR\file37c39972008.stan’ nicht löschen. Grund ‘No such file or directory’

also when I run the schools.stan model I get this output:
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().
Fehler 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: file37c622deb6.o:file37c622deb6.cpp:(.text+0x84c): 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: file37c622deb6.o:file37c622deb6.cpp:(.text+0x13a7): 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: file37c622deb6.o:file37c622deb6.cpp:(.text+0x88e): 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: file37c622deb6.o:file37c622deb6.cpp:(.text$_ZN3tbb8internal26task_scheduler_observer_v3D1Ev[_ZN3tbb8internal26task_scheduler_observer_v3D1E
Zusätzlich: Warnmeldung:
In file.remove(c(unprocessed, processed)) :
kann Datei ‘C:\Users\tibor\AppData\Local\Temp\Rtmpsh0PnR\file37c61901b28.stan’ nicht löschen. Grund ‘No such file or directory’
Fehler in sink(type = “output”) : ungültige Verbindung

Additional Output:
writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”)))
Output: Fehler in file(con, “r”) : kann Verbindung nicht öffnen
Zusätzlich: Warnmeldung:
In file(con, “r”) :
kann Datei ‘C:\Users\tibor\Documents/.R/Makevars’ nicht öffnen: No such file or directory

devtools::session_info(“rstan”)
Output: Fehler in loadNamespace(name) : es gibt kein Paket namens ‘devtools’

Thanks in advance and sorry for the german error messages.

Thank you for the quick reply!
Is there a new link for rstan 2.21.2? Because i get “HTTP status was ‘404 Not Found’” when trying to update rstan.

Sorry about that. Can you try again? The links should be working now.

It works now, thank you so much! At least for simpler models, I haven’t tried anything more advanced yet.

1 Like

Ok great. Definitely let us know if you run into issues with more complicated models, but glad it’s working!