Error / bug in brms models?

Hi,

I am having a weird problem with brms. My models don’t seem to run, and I get the error:

running command ''/Library/Frameworks/R.framework/Resources/bin/R' CMD config CXX14 2>/dev/null' had status 72

I recently updated OSX to Mojave. I received the same error in brms 2.6.0 and the dev version 2.6.1

Does it look like something on my end or the brms end? Thanks!
Jon

sample Model:

o_test <- brm(
  state ~ pheno, data = data, 
  family = cumulative(),
  iter = 5000
 )

Data is attached as csv

Here is the traceback

Error in if (nchar(CXX) == 0) { : argument is of length zero
11.
(function (file, model_name = "anon_model", model_code = "", stanc_ret = NULL, boost_lib = NULL, eigen_lib = NULL, save_dso = TRUE, verbose = FALSE, auto_write = rstan_options("auto_write"), obfuscate_model_name = TRUE, allow_undefined = FALSE, includes = NULL) ...
10.
do.call(rstan::stan_model, stan_model_args)
9.
eval(expr, envir)
8.
eval(expr, envir)
7.
eval(expr, pf)
6.
eval(expr, pf)
5.
withVisible(eval(expr, pf))
4.
evalVis(expr)
3.
utils::capture.output(out <- eval(expr, envir), type = type, ...)
2.
eval_silent(do.call(rstan::stan_model, stan_model_args), silent = silence_stan_model, type = "message")
1.
brm(state ~ pheno, data = data2, family = cumulative(), iter = 5000)

Please also provide the following information in addition to your question:

  • Operating System:OSX Mojave 10.14
  • brms Version: 2.6.1ordinal_test.csv (3.1 KB)

You probably need

Thanks, but I added the flags to ~/.R/Makevars and I am getting the same error.

It also doesn’t look like I have the /usr/include directory, so the flags I added probably wouldn’t do anything anyways.

running command ''/Library/Frameworks/R.framework/Resources/bin/R' CMD config CXX14 2>/dev/null' had status 72

Do you have a /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include directory?

No, I don’t have any SDK directories in /Library/Developer/CommandLineTools

OK. If you look in Spotlight for stdlib.h does it have a path to it anywhere?

No, not that I can find

OK, it looks like Mojave knocked out everything related to C++. Maybe try https://github.com/coatless/r-macos-rtools#how-do-i-use-the-installer again?

Ran into another problem…

I downloaded the installer from the release page. I tried a few times but kept getting the error.

OK. @coatless may have to jump in here, unless someone else with a Mac has encountered this problem?

Yup, I’m aware. I should have a fix for this later this evening @jonnations.

Cool, thanks for the help @coatless & @bgoodri !

@jonnations I wanted to give you an update on what’s up. The r-macos-rtools setup is failing due to Apple removing the Xcode CLI binary from download for macOS Mojave.

c.f. https://twitter.com/axiomsofxyz/status/1058724317524049920

Due to the way the official CRAN binary is built, we partially rely on system headers from the installation (in addition to clang6's). I’m working on figuring out a better solution for this issue. I may download the binary file directly, host it on github, and then handle patching… TBD.

Not sure if this helps at all, but brms 2.6.0 on Mojave works with no issues for me

  • Operating System:OSX Mojave 10.14
  • brms Version: 2.6.0

I had the same problem this week, i reinstalled xcode and all the tings needed for r to compile c++, than tested if it did. the problem comes from thu upgrade which breaks the c++ compiling.

it was really wierd because it did nt even give me an error, BRMS just does nothing after giving the command to compile. Fixxed now btw.

Yes, that is happening with mine now. Initially I received an error, but no it just says Compiling C++ then stops.

@Kevin_Ackermans besides Xcode, what else did you reinstall?

Please try

library(rstan)
example(stan_model, run.dontrun = TRUE)

and report what the output is, if any.

@bgoodri

stn_md> stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'

stn_md> mod <- stan_model(model_code = stancode)
Error in if (nchar(CXX) == 0) { : argument is of length zero
In addition: Warning message:
In system2(file.path(R.home(component = "bin"), "R"), args = paste("CMD config",  :
  running command ''/Library/Frameworks/R.framework/Resources/bin/R' CMD config CXX14 2>/dev/null' had status 69

rstan Version 2.18.2

Open Xcode via Spotlight and accept the license.