Dealing with Catalina

Next version of R will be 4.0.0 to account for the compile toolchain switch, c.f. http://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2019/10/01#n2019-10-01

Correct.

Have you begun testing with RTools 4.0? Jeroen Ooms made it available:

Yes, I have been encouraging people to test rstan on it

for a while, but AFAIK I am the only one who has. It works (except LTO) for me, but it is a huge change.

I just tried this (after uninstalling RStan and using @coatless new installer) and got:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun ERROR: compilation failed for package ‘rstan’

So it appears that I am unable to actually compile Stan. Have you seen this error anywhere else since the Catalina roll out?

Try first doing xcode-select --install from the Terminal app or the Terminal tab of RStudio.

So, the installer attempts to install the Xcode CLI tools for you. In the process, we trigger:

sudo xcode-select --reset

And then

sudo xcode-select --install

The reset should fix the xcrun error, From there, the installation should be fine.

What macOS are you on? Mojave or Catalina?

I’m running Catalina (unfortunately). running xcode-select --install seems to have fixed the xcrun error (at least it did for installing cmdstanr which failed with a similar error initially). Unfortunately, I’m still waiting for that to finish compiling and haven’t been able to try install.packages(“rstan”, type = “source”) yet. As soon as cmdstanr is finished, I’ll give that a shot and post an update.
Thanks

@mattwilliamson13 if CmdStanR still gives you trouble maybe @ssp3nc3r can help. I know he (and others) have been able to get it running on Catalina.

Thanks @Jonah. Do you have any sense for how long CmdStanR should take to compile during the install on a 2015 MacBook Pro with moderate specs? Are we talking minutes? Hours? To clarify, I mean the install_cmdstan() install and compile of Stan

I can’t really tell if I’m making progress

Minute

So 2 hours of compiler messages in Studio during the install_cmdstan() call is a bad sign then?

It is possible the compiler warnings may have overtaxed RStudio’s buffer. In which case, I would start over after squashing them

https://mc-stan.org/misc/warnings.html#compiler-warnings

Just to make sure I understand - I should squash these warnings during the install (not just during compilation of the model?

Both

I’m not getting any messages with square brackets so am not sure what to add to the Makevars file. Example output is clang++ -std=c++1y -Wno-unknown-warning-option -Wno-tautological-compare -Wno-sign-compare -D_REENTRANT -I stan/lib/stan_math/lib/tbb_2019_U8/include -O3 -I src -I stan/src -I lib/rapidjson_1.1.0/ -I stan/lib/stan_math/ -I stan/lib/stan_math/lib/eigen_3.3.3 -I stan/lib/stan_math/lib/boost_1.69.0 -I stan/lib/stan_math/lib/sundials_4.1.0/include -DBOOST_DISABLE_ASSERTS -c -MT bin/cmdstan/lang/grammars/indexes_grammar_inst.o -MT stan/src/stan/lang/grammars/indexes_grammar_inst.d -MM -E -MG -MP -MF stan/src/stan/lang/grammars/indexes_grammar_inst.d stan/src/stan/lang/grammars/indexes_grammar_inst.cpp

This worked to allow me to get RStan installed and 8 schools ran 3x without throwing the exception, so that seems to be working now. I’m not sure what’s happened with CmdStanR, but this seems to have fixed my problem with RStan and the original exception issues.

Yeah should take minutes. This sounds similar to what @ssp3nc3r saw initially but then he had to remove an Renviron file or something. @ssp3nc3r can you remind us?

Actually found it:

@bgoodri do you think this .Renviron problem means that the same setup won’t work for both rstan and cmdstanr if using @coatless’s installer?

1 Like

Memory is faded on this, so what I say would be off, but I seem to recall we just removed the .Renviron and .R/Makevars files so that cmdstanr compiled using the basic apple clang. Before we did this, my .Renviron still had the clang7 path in it.

I’m a little confused in reviewing the above thread what pertains to rstan issues within the Catalina environment, and what pertains to cmdstanr … perhaps we should separate these issues?

Please separate out the issues. Provide a minimal reproducible example on the cmdstanr.

I’m wondering if an flag is needed to quiet the deprecation warnings associated with BH and RcppEigen.

The fix for Catalina involved setting SHLIB_CXXFLAGS in ~/.R/Makevars, which should be irrelevant to CmdStan because it does not create a shared library.