Compiling error

Hello,

After trying to fit this model:
xbayes <- brm(y ~ x, mytib)

I am getting this error:

Compiling the C++ model
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from file12e812ef45c72.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:8:
In file included from /usr/local/clang4/bin/…/include/c++/v1/cstdlib:86:
In addition: Warning message:
In system(cmd, intern = !verbose) :

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from file12e812ef45c72.cpp:8:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/src/stan/model/model_header.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/mat.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/rev/core/autodiffstackstorage.hpp:4:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/StanHeaders/include/stan/math/memory/stack_alloc.hpp:8:
In file included from /usr/local/clang4/bin/…/include/c++/v1/cstdlib:86:
Error in sink(type = “output”) : invalid connection

I did this and I got 10:

fx <- inline::cxxfunction( signature(x = “integer”, y = “numeric” ) , ’
return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
’ )
fx( 2L, 5 ) # should be 10

Here is more information:

sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14

I have Xtools 10 installed.
rstan 2.18.2
rstantools 1.5.1

Thank you very much!

Try

stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'
mod <- stan_model(model_code = stancode, verbose = TRUE)

and tell us what is the string involving error: (with the colon).

This one:

In file included from /usr/local/clang4/bin/…/include/c++/v1/cstdlib:86:
/usr/local/clang4/bin/…/include/c++/v1/stdlib.h:94:15: fatal error: ‘stdlib.h’ file not found

I really appreciate your help, but I feel like you’re speaking Russian to me (I don’t speak Russian). I am a psychologist, not a programmer/developer, and I’m getting more confused. I tried the first option and did not work.

I followed this path:
/Library/Developer/CommandLineTools/Packages/

and the only thing I found is a folder called usr which only contains another one called share.

I do not know how to rename / delete / empty the ~/.R/Makevars either :(

Hi again,

I updated Mojave, and reinstalled Xcode. I got the latest version (10.2 beta 4). Now the error I’m getting is this:

Compiling the C++ model
running command ‘’/Library/Frameworks/R.framework/Resources/bin/R’ CMD config CXX14 2>/dev/null’ had status 1Error in if (nchar(CXX) == 0) { : argument is of length zero

^bangs head against table in frustration^

Make sure you have accepted the license agreement for Xcode by opening it once via Spotlight. Then tell us what

pkgbuild::has_build_tools(debug = TRUE)

says.