Installing rstan on RHEL7

Solved by adding this to the final line of makefile.
Thank you.

That is only going to work for the 2.18.x release though. Soon, you are going to need to be using a later compiler.

So you think that Rcpp is still attempting to use the wrong version of gcc?

system('g++ -v') gives me 5.3.0 and I know that I couldn’t get rstan 2.18.1 to install until I recompiled gcc 5.3.0 with the matching gfortran, so at least install.packages is using the 5.3.0 version of gcc.

Do you have a way to verify that Rcpp using the right version of gcc? The stackoverflow method of forcing a gcc version (CXX14=g++-5.3) apparently does not work for gcc versions greater than 4.9. I know that I have gcc version 4.8.5 and 5.3.0 installed, but everything else seems to use 5.3.0.

@Peter_Adelman I think your setup is fine. But @Ziyi_Chen said that this error

was overcome by adding -std=c++11 to the makefile, which works today but won’t work once Stan starts using C++14 syntax. g++-4.9.3 is the floor for partial C++14 support.

Ah, the error I get is this:

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! In file included from /app/gcc5_new/include/c++/5.3.0/thread:35:0,
from /app/R/lib64/R/library/StanHeaders/include/stan/math/prim/mat/functor/map_rect_concurrent.hpp:10,
from /app/R/lib64/R/library/StanHeaders/include/stan/math/prim/mat/functor/map_rect.hpp:13,
from /app/R/lib64/R/library/StanHeaders/include/stan/math/prim/mat.hpp:262,
from /app/R/lib64/R/library/StanHeaders/include/stan/math/rev/mat.hpp:12,
from /app/R/lib64/R/library/StanHeaders/include/stan/math.hpp:4,
from /app/R/lib64/R/library/StanHeaders/include/src/stan/model/model_header.hpp:4,
from filebda46593c6de.cpp:8:
/app/gcc5_new/include/c++/5.3.0/bits/c++0x_warning.h:32:2: 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+
In addition: Warning message:
running command ‘/app/R/lib64/R/bin/R CMD SHLIB filebda46593c6de.cpp 2> filebda46593c6de.cpp.err.txt’ had status 1

I assumed that the -std=c+ suggestion was getting truncated, because that is not a valid specification, and was using -std=c++11.

OK, you should be fine going forward as long as the -std=c++14 or -std=c++1y flag is passed.