我尝试安装 rstan,这是用于 MCMC 采样的 R 包,需要编译才能工作。遗憾的是,make 和编译器在安装过程中失败,并显示一条非常长的错误消息,我仅发布最后几个步骤:
/home/XXX/R/x86_64-pc-linux-gnu-library/3.2/BH/include/boost/phoenix/core/detail/preprocessed/actor_operator_10.hpp:557:9: note: template<class A0, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> typename boost::phoenix::result_of::actor<typename boost::mpl::eval_if_c<boost::mpl::or_<boost::phoenix::is_custom_terminal<Expr>, mpl_::bool_<boost::is_placeholder<Expr>::value> >::value, boost::proto::terminal<T>, boost::mpl::identity<T> >::type::proto_base_expr, const A0&, const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&>::type boost::phoenix::actor<Expr>::operator()(const A0&, const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) const [with A0 = A0; A1 = A1; A2 = A2; A3 = A3; A4 = A4; A5 = A5; A6 = A6; A7 = A7; A8 = A8; A9 = A9; Expr = boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::assign, boost::proto::argsns_::list2<boost::proto::exprns_::expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::spirit::attribute<0> >, 0l>, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::phoenix::detail::tag::function_eval, boost::proto::argsns_::list4<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<stan::gm::subtraction_expr3>, 0l>, boost::phoenix::actor<boost::spirit::attribute<0> >, boost::phoenix::actor<boost::spirit::argument<0> >, boost::phoenix::actor<boost::proto::exprns_::basic_expr<boost::proto::tagns_::tag::terminal, boost::proto::argsns_::term<boost::reference_wrapper<std::basic_stringstream<char> > >, 0l> > >, 4l> > >, 2l>]
operator()(A0 const& a0 , A1 const& a1 , A2 const& a2 , A3 const& a3 , A4 const& a4 , A5 const& a5 , A6 const& a6 , A7 const& a7 , A8 const& a8 , A9 const& a9) const
^
/home/XXX/R/x86_64-pc-linux-gnu-library/3.2/BH/include/boost/phoenix/core/detail/preprocessed/actor_operator_10.hpp:557:9: note: template argument deduction/substitution failed:
In file included from /home/XXX/R/x86_64-pc-linux-gnu-library/3.2/BH/include/boost/spirit/home/qi/action/action.hpp:21:0,
from /home/XXX/R/x86_64-pc-linux-gnu-library/3.2/BH/include/boost/spirit/home/qi/action.hpp:14,
from /home/XXX/R/x86_64-pc-linux-gnu-library/3.2/BH/include/boost/spirit/home/qi.hpp:14,
from /home/XXX/R/x86_64-pc-linux-gnu-library/3.2/BH/include/boost/spirit/include/qi.hpp:16,
from ../inst/include/stansrc/stan/gm/grammars/expression07_grammar_def.hpp:16,
from ../inst/include/stansrc/stan/gm/grammars/expression07_grammar_inst.cpp:1,
from gm__grammars__expression07_grammar_inst.cpp:1:
/home/XXX/R/x86_64-pc-linux-gnu-library/3.2/BH/include/boost/spirit/home/support/action_dispatch.hpp:178:39: note: candidate expects 10 arguments, 3 provided
f(attr_wrap, context, pass);
make: *** [gm__grammars__expression07_grammar_inst.o] Error 1
ERROR: compilation failed for package ‘rstan’
之前这个错误信息重复出现过几次,包括稍长的堆栈跟踪。
这个问题看起来类似,但那里的人收到不同的错误消息,因此我认为这值得提出一个新问题
我将不胜感激任何帮助,编译器或其设置可能存在什么问题
答案1
我也遇到了同样的问题。这个方法帮我解决了:
devtools::install_url("http://cran.r-project.org/src/contrib/Archive/BH/BH_1.55.0-3.tar.gz")
devtools::install_url("https://github.com/stan-dev/rstan/releases/download/v2.6.0/rstan_2.6.0.tar.gz",dependencies = FALSE)
library(rstan)
set_cppo("fast")
来自STAN 用户组。