stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.04k stars 269 forks source link

Unable to install Rstan with R 3.4.4 #683

Open mbeddo opened 5 years ago

mbeddo commented 5 years ago

Using install.packages function, I get compilation errors. I am using R 3.4.4 on Ubuntu 16.04.5 LTS.

A portion of the output showing the errors:

In file included from chains.cpp:19:0: /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp: In function 'typename boost::math::tools::promote_args::type stan::math::mean(const std::vector&)': /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24:63: error: an array reference cannot appear in a constant-expression Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1>> m(&v[0], v.size()); ^ /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24:63: error: '&' cannot appear in a constant-expression /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24:68: error: '.' cannot appear in a constant-expression Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1>> m(&v[0], v.size()); ^ /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24:73: error: a function call cannot appear in a constant-expression Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1>> m(&v[0], v.size()); ^ /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24:74: error: a function call cannot appear in a constant-expression Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1>> m(&v[0], v.size()); ^ /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24:74: error: template argument 3 is invalid /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24:74: error: template argument 4 is invalid /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24:74: error: template argument 6 is invalid /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:24:27: error: template argument 1 is invalid Eigen::Map<const Eigen::Matrix<T, Eigen::Dynamic, 1>> m(&v[0], v.size()); ^ /usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/mean.hpp:25:10: error: 'm' was not declared in this scope return m.mean(); ^

bgoodri commented 5 years ago

My guess is that your compiler is too old. For g++, it should be at least version 5 on Linux.