Error using brms on RHEL

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

  • Operating System: Red Hat Enterprise Linux 7.7
  • brms Version:2.10.0

I’m trying to run the basic example in brms on our departmental server, but it keeps throwing an error. I’m on R version 3.6.0. My .Makevars file is:
CXX14 = g++ -std=c++1y
MAKEFLAGS = -j4
CXX14FLAGS=-O3 -march=native -mtune=native -fPIC
CXX11FLAGS=-O3 -march=native

The error is given below.
Any help would be appreciated

data(epilepsy)
fit1 <- brm(count ~ zAge + zBase * Trt + (1|patient),

  •         data = epilepsy, family = poisson())
    

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 /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/BH/include/boost/random/detail/integer_log2.hpp:19:0,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/BH/include/boost/random/detail/int_float_pair.hpp:26,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/BH/include/boost/random/exponential_distribution.hpp:27,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/BH/include/boost/random/gamma_distribution.hpp:25,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders/include/stan/math/prim/mat/prob/dirichlet_rng.hpp:5,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders/include/stan/math/prim/mat.hpp:292,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders/include
In addition: Warning message:
In system(cmd, intern = !verbose) :
running command ‘/usr/lib64/R/bin/R CMD SHLIB file7a5dcf0de10.cpp 2> file7a5dcf0de10.cpp.err.txt’ had status 1
Error in sink(type = “output”) : invalid connection

My guess is that your C++ compiler is too old. What is the error message (starts with error:) when you do

example(stan_model, package = "rstan", run.dontrun = TRUE)

?

That throws the eventual error:
Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /usr/include/c++/4.8.2/type_traits:35:0,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders/include/stan/math/prim/scal/meta/is_constant.hpp:4,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders/include/stan/math/prim/arr/meta/is_constant_struct.hpp:4,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders/include/stan/math/prim/mat/meta/is_constant_struct.hpp:4,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders/include/stan/math/prim/mat.hpp:15,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders/include/stan/math/rev/mat.hpp:12,
from /storage01/users/ozd504/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders/include/stan/math.hpp:4,
from /storage01/us

We need the part that starts with error: but I can tell from the 4.8.2 stuff that the error is that C++14 is not supported.

Thank you, the first error I see is:
error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.

Right. It actually needs to be C++14 to work with Stan. You need
https://developers.redhat.com/products/developertoolset/overview

Thank you Ben, i’ve contacted my sys admin.

Sorry, one more question from my sys admin, what version of linux do you use to develop Stan?

We don’t develop Stan on or for any particular operating system. You just need a compiler that supports the C++14 standard. On Linux, that is going to be g++ version 5 or later or clang++ version 4 or later.

We installed the developer tools and now everything works as it should, thanks again for the help