Compiling c++ with RStan in Sonoma

I've updated Mac OS to Sonoma. RStan stopped working and it's linked to the inability of R to access the compiler. That is everything works that doesn't necessitate c++ compilation from the R console. For example, RStanArm works.

I did the usual things that I usually do, delete R, RStudio, reinstall CommandLineTools, reinstall everything, but it still doesn't work.

When I open R, library(Rstan) and run a very basic model like the first one provide in ?Rstan, I get:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cstring:66:5: error: <cstring> tried including <string.h> but didn't find libc++'s <string.h> header.           This usually means that your header search paths are not configured properly.           The header search paths should contain the C++ Standard Library headers before           any C Standard Library, and you are probably using compiler flags that make that           not be the case.#   error <cstring> tried including <string.h> but didn't find libc++'s <string.h> header. \    ^fatal error: too many errors emitted, stopping now [-ferror-limit=]20 errors generated.make: *** [file1a71725f2695.o] Error 1
Error in sink(type = "output") : invalid connection

I suspect I need to go in a file somewhere like ~/.R/Makevars and edit something, but I can't figure out.

Any help appreciated.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.