Error when installing Rstan 2.16.2

Operating System: Centos 7.3
Interface Version:2.16.2
Compiler/Toolkit:Intel 2017 update 4

When trying to install Rstan into a recently built R-3.4.1 I see the following error message:

on_operator_10.hpp(91): error: argument of type “const char *” is incompatible with parameter of type "char *"
return detail::expression::function_eval<F, A0 , A1 , A2 , A3 , A4>::make(f, a0 , a1 , a2 , a3 , a4);

I’ve tried to install manually by setting the PKG_CXXFLAGS variable to add a “-std=” flag to set different C++ standards (e.g. gnu++11), but the only value that results in a successful install is “-std=gnu++98”. However, using that flag generates a compiler warnings that makes me suspect that option may be breaking something:

/usr/shared_apps/packages/R-3.4.1/lib64/R/library/StanHeaders/include/src/stan/lang/ast/node/conditional_op.hpp(40): warning #3500: field initializers are a C++11 feature
bool has_var_ = false;

I see similar errors and warnings when attempting to use Gnu compilers (either the system default 4.8.5 or a manually built 6.3.0)

Can anyone advise what’s going wrong here? I’m not sure if this a bug in an R C++ library, a compiler bug, a bad choice of R install flags, etc. Full log of compiler output from “install.packages(‘rstan’)” available if it helps, though it’s 1700+ lines long!

You temporarily have to add -DBOOST_PHOENIX_NO_VARIADIC_EXPRESSION to the end of the CXXFLAGS or CPPFLAGS line in the ~/.R/Makevars file.

Thanks - that’s a confirmed fix. Instead of modifying the Makevars file I used the command line option: