Rstanarm package installation failure

I am using RStudio running on an Amazon Linux server in EC2. My colleagues are currently using RStudio running on the same server. They have successfully installed and have been utilizing the rstanarm package. I have attempted to install the rstanarm package multiple times and failed each and every time.

It appears that I’m encountering compiler issues. I’ve tried a number of different CXX/CXXFLAG settings in my ~/.R/Makevars file, but none have worked. The ~/.R/Makevars file contents for my colleagues are completely different, but both are able to load/use rstanarm. What are the appropriate
settings for the ~/.R/Makevars file? Any and all insight shared will be greatly appreciated.

Also, I have been able to successfully install rstan, rstantools, and shinystan.

Thank you.
Steve

Error Info | Session Info are below.

Part of error received:

make: *** [stan_files/jm.o] Error 1
rm stan_files/jm.cc
ERROR: compilation failed for package ‘rstanarm’
* removing ‘/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstanarm’
Warning in install.packages :
  installation of package ‘rstanarm’ had non-zero exit status

Session Info:

─ Session info 
 setting      value                       
 version     R version 3.4.1 (2017-06-30)
 os             Amazon Linux AMI 2018.03    
 system     x86_64, linux-gnu           
 ui              RStudio                     
 language  (EN)                        
 collate      en_US.UTF-8                 
 ctype        en_US.UTF-8                 
 tz              <NA>                        
 date          2019-10-27             

Need more of the error message. If the only error is from jm.cc, you may have just run out of RAM.

Hi, Ben -

Thank you very much for your prompt response to my question. I really appreciate your time. Please see the error message below, and let me know if there is any additional information I need to provide.

Best,
Steve

Full Error Message:

* installing *source* package ‘rstanarm’ ...
** package ‘rstanarm’ successfully unpacked and MD5 sums checked
** libs
"/usr/lib64/R/bin/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/jm.stan
Wrote C++ file "stan_files/jm.cc"


g++ -std=c++1y -Wno-unused-variable -Wno-unused-function -fPIC  -I/usr/include/R -DNDEBUG -I"../inst/include" -I"/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -DBOOST_MATH_OVERFLOW_ERROR_POLICY=errno_on_error -I"/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include" -I"/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstan/include" -I"/usr/lib64/R/library/BH/include" -I"/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I"/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/RcppEigen/include" -I/usr/local/include     -fPIC  -c stan_files/jm.cc -o stan_files/jm.o
In file included from /usr/lib64/R/library/BH/include/boost/random/detail/integer_log2.hpp:19:0,
                 from /usr/lib64/R/library/BH/include/boost/random/detail/large_arithmetic.hpp:19,
                 from /usr/lib64/R/library/BH/include/boost/random/detail/const_mod.hpp:23,
                 from /usr/lib64/R/library/BH/include/boost/random/linear_congruential.hpp:30,
                 from /usr/lib64/R/library/BH/include/boost/random/additive_combine.hpp:27,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstan/include/rstan/stan_fit.hpp:15,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstan/include/rstan/rstaninc.hpp:3,
                 from stan_files/jm.hpp:18,
                 from stan_files/jm.cc:3:
/usr/lib64/R/library/BH/include/boost/pending/integer_log2.hpp:7:89: note: #pragma message: This header is deprecated. Use <boost/integer/integer_log2.hpp> instead.
 BOOST_HEADER_DEPRECATED("<boost/integer/integer_log2.hpp>");
                                                                                         ^
In file included from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/fun/ordered_constrain.hpp:6:0,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat.hpp:41,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src/stan/model/test_gradients.hpp:7,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstan/include/rstan/stan_fit.hpp:35,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstan/include/rstan/rstaninc.hpp:3,
                 from stan_files/jm.hpp:18,
                 from stan_files/jm.cc:3:
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:31:32: error: ‘std::index_sequence’ has not been declared
                           std::index_sequence<I...> i) {
                                ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:31:46: error: expected ‘,’ or ‘...’ before ‘<’ token
                           std::index_sequence<I...> i) {
                                              ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp: In function ‘constexpr auto stan::math::internal::apply(const F&, const Tuple&)’:
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:49:27: error: ‘make_index_sequence’ is not a member of ‘std’
   return apply_impl(f, t, std::make_index_sequence<std::tuple_size<Tuple>{}>{});
                           ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:49:27: note: suggested alternative:
In file included from /usr/lib64/R/library/BH/include/boost/fusion/container/vector/vector.hpp:28:0,
                 from /usr/lib64/R/library/BH/include/boost/fusion/container/vector/vector10.hpp:25,
                 from /usr/lib64/R/library/BH/include/boost/fusion/view/transform_view/transform_view.hpp:22,
                 from /usr/lib64/R/library/BH/include/boost/fusion/algorithm/transformation/transform.hpp:11,
                 from /usr/lib64/R/library/BH/include/boost/fusion/view/zip_view/detail/begin_impl.hpp:14,
                 from /usr/lib64/R/library/BH/include/boost/fusion/view/zip_view/zip_view.hpp:16,
                 from /usr/lib64/R/library/BH/include/boost/fusion/view/zip_view.hpp:12,
                 from /usr/lib64/R/library/BH/include/boost/fusion/include/zip_view.hpp:11,
                 from /usr/lib64/R/library/BH/include/boost/numeric/odeint/util/resize.hpp:26,
                 from /usr/lib64/R/library/BH/include/boost/numeric/odeint/util/state_wrapper.hpp:26,
                 from /usr/lib64/R/library/BH/include/boost/numeric/odeint/util/ublas_wrapper.hpp:33,
                 from /usr/lib64/R/library/BH/include/boost/numeric/odeint.hpp:25,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/prim/arr/functor/integrate_ode_rk45.hpp:17,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/prim/arr.hpp:46,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/prim/mat.hpp:344,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat.hpp:12,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src/stan/model/test_gradients.hpp:7,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstan/include/rstan/stan_fit.hpp:35,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstan/include/rstan/rstaninc.hpp:3,
                 from stan_files/jm.hpp:18,
                 from stan_files/jm.cc:3:
/usr/lib64/R/library/BH/include/boost/fusion/support/detail/index_sequence.hpp:59:12: note:   ‘boost::fusion::detail::make_index_sequence’
     struct make_index_sequence
            ^
In file included from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/fun/ordered_constrain.hpp:6:0,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat.hpp:41,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src/stan/model/log_prob_grad.hpp:4,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src/stan/model/test_gradients.hpp:7,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/src/stan/services/diagnose/diagnose.hpp:10,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstan/include/rstan/stan_fit.hpp:35,
                 from /home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstan/include/rstan/rstaninc.hpp:3,
                 from stan_files/jm.hpp:18,
                 from stan_files/jm.cc:3:
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:49:77: error: expected primary-expression before ‘{’ token
   return apply_impl(f, t, std::make_index_sequence<std::tuple_size<Tuple>{}>{});
                                                                             ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:49:77: error: expected ‘)’ before ‘{’ token
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp: At global scope:
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:151:9: error: expected type-specifier
       = std::result_of_t<F(decltype(is_var_), decltype(value_of(Targs()))...)>;
         ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:156:42: error: ‘FReturnType’ was not declared in this scope
   std::array<int, internal::compute_dims<FReturnType>::value> M_;
                                          ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:156:53: error: template argument 1 is invalid
   std::array<int, internal::compute_dims<FReturnType>::value> M_;
                                                     ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:156:61: error: template argument 2 is invalid
   std::array<int, internal::compute_dims<FReturnType>::value> M_;
                                                             ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp: In member function ‘std::vector<stan::math::var> stan::math::adj_jac_vari<F, Targs>::build_return_varis_and_vars(const std::vector<double>&)’:
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:349:9: error: invalid types ‘int[int]’ for array subscript
     M_[0] = val_y.size();
         ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:350:32: error: invalid types ‘int[int]’ for array subscript
     std::vector<var> var_y(M_[0]);
                                ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp: In member function ‘Eigen::Matrix<stan::math::var, R, C> stan::math::adj_jac_vari<F, Targs>::build_return_varis_and_vars(const Eigen::Matrix<double, R, C>&)’:
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:375:9: error: invalid types ‘int[int]’ for array subscript
     M_[0] = val_y.rows();
         ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:376:9: error: invalid types ‘int[int]’ for array subscript
     M_[1] = val_y.cols();
         ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:377:40: error: invalid types ‘int[int]’ for array subscript
     Eigen::Matrix<var, R, C> var_y(M_[0], M_[1]);
                                        ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:377:47: error: invalid types ‘int[int]’ for array subscript
     Eigen::Matrix<var, R, C> var_y(M_[0], M_[1]);
                                               ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp: In member function ‘void stan::math::adj_jac_vari<F, Targs>::chain()’:
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:530:5: error: ‘FReturnType’ was not declared in this scope
     FReturnType y_adj;
     ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:530:17: error: expected ‘;’ before ‘y_adj’
     FReturnType y_adj;
                 ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:532:38: error: ‘y_adj’ was not declared in this scope
     internal::build_y_adj(y_vi_, M_, y_adj);
                                      ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:536:26: error: expansion pattern ‘auto&&’ contains no argument packs
         [this](auto&&... args) { this->accumulate_adjoints(args...); },
                          ^
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp: In lambda function:
/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/StanHeaders/include/stan/math/rev/mat/functor/adj_jac_apply.hpp:536:60: error: ‘args’ was not declared in this scope
         [this](auto&&... args) { this->accumulate_adjoints(args...); },
                                                            ^
rm stan_files/jm.cc
make: *** [stan_files/jm.o] Error 1
ERROR: compilation failed for package ‘rstanarm’
* removing ‘/home/vssr07/R/x86_64-redhat-linux-gnu-library/3.4/rstanarm’
Warning in install.packages :
  installation of package ‘rstanarm’ had non-zero exit status

This is due to C++14 not being supported by the default RedHat compiler, despite its being patched to take the flag. You need
https://developers.redhat.com/products/developertoolset/overview
and