Following up on @hsbadr 's request (R Package Maintainers Using Stan - Please Read - #17 by hsbadr), I tested the rstan and StanHeaders v2.26.4 with an rstantools-based R package and found I wasn’t able to compile the models.
I uninstalled rstan and rstantools, installed the latest versions, and ran pkgbuild::compile_dll
for this package (GitHub - ConnorDonegan/geostan: Bayesian Spatial Analysis) and it failed with this error message (below).
make: *** [/usr/lib/R/etc/Makeconf:175: stanExports_foundation.o] Error 1
ERROR: compilation failed for package ‘geostan’
─ removing ‘/tmp/RtmprBLLHC/devtools_install_70be35674a15/geostan’
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines):
E> /usr/lib/R/library/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:251:23: required from ‘static void Eigen::internal::generic_product_impl<Lhs, Rhs, Eigen::DenseShape, Eigen::DenseShape, 6>::evalTo(Dst&, const Lhs&, const Rhs&) [with Dst = Eigen::Matrix<double, 1, 1, 0, 1, 1>; Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>; Rhs = Eigen::Matrix<double, -1, 1>]’
E> /usr/lib/R/library/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:124:75: required from ‘Eigen::internal::product_evaluator<Eigen::Product<Lhs, Rhs, Option>, ProductTag, LhsShape, RhsShape>::product_evaluator(c
[...]
Type .Last.error.trace to see where the error occ
> .Last.error.trace
Stack trace:
1. pkgbuild::compile_dll()
2. pkgbuild:::install_min(path, dest = install_dir, components = "li ...
3. pkgbuild:::rcmd_build_tools("INSTALL", c(path, paste("--library=" ...
4. pkgbuild:::with_build_tools(callr::rcmd_safe(..., env = env, ...
5. callr::rcmd_safe(..., env = env, spinner = FALSE, show = FALSE, ...
6. callr:::run_r(options)
7. base:::with(options, with_envvar(env, do.call(processx::run, ...
8. base:::with.default(options, with_envvar(env, do.call(processx::r ...
9. base:::eval(substitute(expr), data, enclos = parent.frame())
10. base:::eval(substitute(expr), data, enclos = parent.frame())
11. callr:::with_envvar(env, do.call(processx::run, c(list(bin, args ...
12. base:::force(code)
13. base:::do.call(processx::run, c(list(bin, args = real_cmdargs, ...
14. (function (command = NULL, args = character(), error_on_status = TRUE, ...
15. throw(new_process_error(res, call = sys.call(), echo = echo, ...
x System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines):
E> /usr/lib/R/library/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:251:23: required from ‘static void Eigen::internal::generic_product_impl<Lhs, Rhs, Eigen::DenseShape, Eigen::DenseShape, 6>::evalTo(Dst&, const Lhs&, const Rhs&) [with Dst = Eigen::Matrix<double, 1, 1, 0, 1, 1>; Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>; Rhs = Eigen::Matrix<double, -1, 1>]’
E> /usr/lib/R/library/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:124:75: required from ‘Eigen::internal::product_evaluator<Eigen::Product<Lhs, Rhs, Option>, ProductTag, LhsShape, RhsShape>::product_evaluator(const XprType&) [with Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>; Rhs = Eigen::Matrix<double, -1, 1>; int Options = 0; int ProductTag = 6; LhsShape = Eigen::DenseShape; RhsShape = Eigen::DenseShape; typename Eigen::internal::traits<typename Eigen::Product<Lhs, Rhs, Option>::Rhs>::Scalar = double; typename Eigen::internal::traits<typename Eigen::Product<Lhs, Rhs, Option>::Lhs>::Scalar = double; Eigen::internal::product_evaluator<Eigen::Product<Lhs, Rhs, Option>, ProductTag, LhsShape, RhsShape>::XprType = Eigen::Product<Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>, Eigen::Matrix<double, -1, 1>, 0>]’
E> /usr/lib/R/library/RcppEigen/include/Eigen/src/Core/ProductEvaluators.h:35:90: required from ‘Eigen::internal::evaluator<Eigen::Product<Lhs, Rhs, Option> >::evaluator(const XprType&) [with Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>; Rhs = Eigen::Matrix<double, -1, 1>; int Options = 0; Eigen::internal::evaluator<Eigen::Product<Lhs, Rhs, Option> >::XprType = Eigen::Product<Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>, Eigen::Matrix<double, -1, 1>, 0>]’
E> /usr/lib/R/library/RcppEigen/include/Eigen/src/Core/Product.h:132:22: required from ‘Eigen::internal::dense_product_base<Lhs, Rhs, Option, 6>::operator const Scalar() const [with Lhs = Eigen::Product<Eigen::CwiseBinaryOp<Eigen::internal::scalar_product_op<double, double>, const Eigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<double>, const Eigen::Matrix<double, 1, -1> >, const Eigen::Transpose<Eigen::Matrix<double, -1, 1> > >, Eigen::Matrix<double, -1, -1>, 0>; Rhs = Eigen::Matrix<double, -1, 1>; int Option = 0; Eigen::internal::dense_product_base<Lhs, Rhs, Option, 6>::Scalar = double]’
E> /usr/local/lib/R/site-library/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:22:56: required from ‘double stan::mcmc::dense_e_metric<Model, BaseRNG>::T(stan::mcmc::dense_e_point&) [with Model = model_foundation_namespace::model_foundation; BaseRNG = boost::random::additive_combine_engine<boost::random::linear_congruential_engine<unsigned int, 40014, 0, 2147483563>, boost::random::linear_congruential_engine<unsigned int, 40692, 0, 2147483399> >]’
E> /usr/local/lib/R/site-library/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:21:10: required from here
E> /usr/lib/R/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(4) double’} [-Wignored-attributes]
E> make: *** [/usr/lib/R/etc/Makeconf:175: stanExports_foundation.o] Error 1
E> ERROR: compilation failed for package ‘geostan’
E> * removing ‘/tmp/RtmprBLLHC/devtools_install_70be35674a15/geostan’
> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.26.4 StanHeaders_2.26.4
loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 compiler_4.1.1 pillar_1.6.4
[4] prettyunits_1.1.1 tools_4.1.1 pkgbuild_1.2.0
[7] lattice_0.20-45 jsonlite_1.7.2 lifecycle_1.0.1
[10] tibble_3.1.5 gtable_0.3.0 pkgconfig_2.0.3
[13] rlang_0.4.12 Matrix_1.3-4 rstudioapi_0.13
[16] DBI_1.1.1 cli_3.0.1 parallel_4.1.1
[19] curl_4.3.2 loo_2.4.1 gridExtra_2.3
[22] dplyr_1.0.7 desc_1.4.0 generics_0.1.0
[25] vctrs_0.3.8 rprojroot_2.0.2 tidyselect_1.1.1
[28] stats4_4.1.1 grid_4.1.1 glue_1.4.2
[31] inline_0.3.19 R6_2.5.1 BH_1.75.0-0
[34] processx_3.5.2 fansi_0.5.0 purrr_0.3.4
[37] ggplot2_3.3.5 callr_3.7.0 magrittr_2.0.1
[40] codetools_0.2-18 matrixStats_0.61.0 scales_1.1.1
[43] ps_1.6.0 ellipsis_0.3.2 assertthat_0.2.1
[46] colorspace_2.0-2 V8_3.4.2 utf8_1.2.2
[49] RcppParallel_5.1.4 munsell_0.5.0 RcppEigen_0.3.3.9.1
[52] crayon_1.4.1