RStan stopped working. So I deleted R RStudio, installed XCode anew. Installed R, RStudio, Rstan.
It all works, except compilation. For example, rstanarm works, so Stan works.
However it doesn’t compile. By trying to get a basic Stan model to compile, I get:
Error in compileCode(f, code, language = language, verbose = verbose) :
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/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: *** [file75d10bdefef.o] Error 1
I am having the same problem on an Intel Mac Sonoma OS 14.1.1
rstanarm works fine. I get a compilation error when compiling a stan example. (see message below). Ideas appreciated.
Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
^file45ea3e955d03.cpp:430:60: note: in instantiation of member function ‘rstan::stan_fit<model45ea527f724a_example_namespace::model45ea527f724a_example, boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399>>>::standalone_gqs’ requested here boost::random::ecuyer1988>::standalone_gqs); ^102 warnings and 1 error generated.make: *** [file45ea3e955d03.o] Error 1
What I did:I removed Command Line Tools. I updated Sonoma to 14.1.1. I deleted completely Homebrew (this was radical and I’m not sure it was needed, but I didn’t really need Homebrew). I installed the latest regular (non-beta) Xcode. I had tried before with CLT only; that didn’t work. CLT 15.1 beta didn’t work for me. Actually all CLT didn’t work for me.
So, update sonoma to latest, update Xcode to latest.
Hi Justin,
Just to clarify. You delete CLT, (skip the macrtools C++ toolchain config - since it installs CLT), then run the rstan .dotR script to configure .R/Makevars. Then install?
I did my Sonoma upgrades on Mac, upgrading to 14.1.1.
I removed CLT from terminal: sudo rm -rf /Library/Developer/CommandLineTools
I installed Xcode from the Mac App Store. So here, since it’s not CLT I didn’t do anything from command line. Just literal download and install.
I’m not sure what rstan .dotR file is. I didn’t configure .R/Makevars. I’ve used Makevars in the past but now it’s empty. I’m not using it. I installed rstan the usual way with install.packages(“rstan”).
OK thanks for your help. I’m running a 2 year old intel Mac. Upgraded to Sonoma 14.1.1, removed CLT and installed a new Xcode 15.0.1. I just tried removing the makevars, and re-installing rstan. I still get the message “ERROR(s) during compilation: source code errors or compiler configuration errors!”
I did install cmdstan and cmdstanr, and this works as expected.
Now when I attempt to build/compile a stan model (in Rstudio) I get a message to “Install Build Tools”. However, the R session pukes when I try to install them.
“Error in sink(type = “output”) : invalid connection”
I’m following this as I have the same issue. Error message I got seems almost the same as what Justin had. I am using Sonoma 14.1.1 and M3 arm. R4.3.2 and the most updated RStudio.
I followed Justin’s suggestion: (a) remove CST and (b) install Xcode from the App Store (V15.0.1). I skipped the upgrading to Sonoma 14.1.1 as I already have it. But still get the same error while running.
Hoping to get some suggestions to move forward to fix this issue. Thanks!
Here is my error message.
Error in compileCode(f, code, language = language, verbose = verbose) :
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/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: *** [file2426231c80b4.o] Error 1