Hello everyone,
I am trying to create a package that depends on rstan. I closely followed the step by step guide Step by step guide for creating a package that depends on RStan • rstantools. However, when I try to call roxygen2::roxygenize(), I receive a lengthy output which ends with the following lines (including an error message):
C:/Users/k_jans13/AppData/Local/Programs/R/R-4.2.2/library/StanHeaders/include/src/stan/mcmc/hmc/hamiltonians/dense_e_metric.hpp:21:10: required from here
C:/Users/k_jans13/AppData/Local/Programs/R/R-4.2.2/library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30:warning: noring attributes on template argument 'Eigen::internal::packet_traits::type{aka '__m128d-Wignored-attributes]
as: stanExports_bbm_Harrison.o: too many sections (40516)
C:\Users\k_jans13\AppData\Local\Temp\ccNE2LLC.s: Assembler messages:
C:\Users\k_jans13\AppData\Local\Temp\ccNE2LLC.s: Fatal error: can’t write 87 bytes to section .text of stanExports_bbm_Harrison.o: ‘file too big’
as: stanExports_bbm_Harrison.o: too many sections (40516)
C:\Users\k_jans13\AppData\Local\Temp\ccNE2LLC.s: Fatal error: stanExports_bbm_Harrison.o: file too big
make: *** [C:/Users/k_jans13/AppData/Local/Programs/R/R-42~1.2/etc/x64/Makeconf:258: stanExports_bbm_Harrison.o] Error 1
ERROR: compilation failed for package ‘bmetabbin’
─ removing ‘C:/Users/k_jans13/AppData/Local/Temp/RtmpuYpFW0/devtools_install_1c345b906580/bmetabbin’
Error in (function (command = NULL, args = character(), error_on_status = TRUE, …
:
! System command ‘Rcmd.exe’ failed
Exit status: 1
stdout & stderr:
Type .Last.error to see the more details.
The output of .Last.error is
<system_command_status_error/rlib_error_3_0/rlib_error/error>
Error in (function (command = NULL, args = character(), error_on_status = TRUE, …
:
! System command ‘Rcmd.exe’ failed
Exit status: 1
stdout & stderr:
Backtrace:
- roxygen2::roxygenise()
- local load_code(base_path)
- pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
- pkgbuild::compile_dll(path, quiet = quiet)
- pkgbuild:::install_min(path, dest = install_dir, components = “libs”, args = if (needs_c…
- pkgbuild::rcmd_build_tools(“INSTALL”, c(path, paste(“–library=”, dest, …
- pkgbuild::with_build_tools({ …
- withr::with_path(rtools_path(), code)
- base::force(code)
- base::withCallingHandlers(callr::rcmd_safe(…, env = env, spinner = FALSE, …
- callr::rcmd_safe(…, env = env, spinner = FALSE, show = FALSE, …
- callr:::run_r(options)
- base::with(options, with_envvar(env, do.call(processx::run, c(list(bin, …
- base::with.default(options, with_envvar(env, do.call(processx::run, …
- base::eval(substitute(expr), data, enclos = parent.frame())
- base::eval(substitute(expr), data, enclos = parent.frame())
- callr:::with_envvar(env, do.call(processx::run, c(list(bin, args = real_cmdargs, …
- base::force(code)
- base::do.call(processx::run, c(list(bin, args = real_cmdargs, stdout_line_callback …
- (function (command = NULL, args = character(), error_on_status = TRUE, …
- base::throw(new_process_error(res, call = sys.call(), echo = echo, …
- | base::signalCondition(cond)
- (function (e) …
- asNamespace(“callr”)$err$throw(e)
I am using Rstan version 2.26.13 on Windows.
The output of devtools::session_info(“rstan”) is:
─ Session info ──────────────────────────────────────────────────────────────────
setting value
version R version 4.2.2 (2022-10-31 ucrt)
os Windows 10 x64 (build 19044)
system x86_64, mingw32
ui RStudio
language (EN)
collate German_Germany.utf8
ctype German_Germany.utf8
tz Europe/Berlin
date 2022-12-20
rstudio 2022.07.2+576 Spotted Wakerobin (desktop)
pandoc NA
─ Packages ──────────────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
backports 1.4.1 2021-12-13 [1] CRAN (R 4.2.0)
BH 1.78.0-0 2021-12-15 [1] CRAN (R 4.2.0)
callr 3.7.3 2022-11-02 [1] CRAN (R 4.2.2)
checkmate 2.1.0 2022-04-21 [1] CRAN (R 4.2.2)
cli 3.4.1 2022-09-23 [1] CRAN (R 4.2.2)
colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.2)
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.2)
curl 4.3.3 2022-10-06 [1] CRAN (R 4.2.2)
desc 1.4.2 2022-09-08 [1] CRAN (R 4.2.2)
fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.2)
farver 2.1.1 2022-07-06 [1] CRAN (R 4.2.2)
ggplot2 3.4.0 2022-11-04 [1] CRAN (R 4.2.2)
glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.2)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.2.2)
gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.2)
inline 0.3.19 2021-05-31 [1] CRAN (R 4.2.2)
isoband 0.2.6 2022-10-06 [1] CRAN (R 4.2.2)
jsonlite 1.8.4 2022-12-06 [1] CRAN (R 4.2.2)
labeling 0.4.2 2020-10-20 [1] CRAN (R 4.2.0)
lattice 0.20-45 2021-09-22 [1] CRAN (R 4.2.2)
lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.2)
loo 2.5.1 2022-03-24 [1] CRAN (R 4.2.2)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.2)
MASS 7.3-58.1 2022-08-03 [1] CRAN (R 4.2.2)
D Matrix 1.5-1 2022-09-13 [1] CRAN (R 4.2.2)
matrixStats 0.63.0 2022-11-18 [1] CRAN (R 4.2.2)
mgcv 1.8-41 2022-10-21 [1] CRAN (R 4.2.2)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.2)
nlme 3.1-160 2022-10-10 [1] CRAN (R 4.2.2)
pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.2)
pkgbuild 1.4.0 2022-11-27 [1] CRAN (R 4.2.2)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.2)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.2.2)
processx 3.8.0 2022-10-26 [1] CRAN (R 4.2.2)
ps 1.7.2 2022-10-26 [1] CRAN (R 4.2.2)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.2)
RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.2.0)
Rcpp 1.0.9 2022-07-08 [1] CRAN (R 4.2.2)
RcppEigen 0.3.3.9.3 2022-11-05 [1] CRAN (R 4.2.2)
D RcppParallel 5.1.5 2022-01-05 [1] CRAN (R 4.2.2)
rlang 1.0.6 2022-09-24 [1] CRAN (R 4.2.2)
rprojroot 2.0.3 2022-04-02 [1] CRAN (R 4.2.2)
rstan * 2.26.13 2022-06-25 [1] local
scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.2)
StanHeaders * 2.26.13 2022-06-25 [1] local
tibble 3.1.8 2022-07-22 [1] CRAN (R 4.2.2)
utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.2)
V8 4.2.2 2022-11-03 [1] CRAN (R 4.2.2)
vctrs 0.5.1 2022-11-16 [1] CRAN (R 4.2.2)
viridisLite 0.4.1 2022-08-22 [1] CRAN (R 4.2.2)
withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.2)
[1] C:/Users/k_jans13/AppData/Local/Programs/R/R-4.2.2/library
The output of `writeLines(readLines(file.path(Sys.getenv(“HOME”), “.R/Makevars”))) is
Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘C:/Users/k_jans13/Documents/.R/Makevars’: No such file or directory
However, the Makevars file is actually in the folder C:/Users/k_jans13/Documents/.R/Makevars and looks like this:
CXX14FLAGS += -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2
I already tried to reinstall rstan and StanHeaders, but the same error still occurred. I found this thread Error when trying to create R package that involves stan, using rstantools - #4 by ebuhle which seems to discuss a similar issue, but I am new to using Stan and do not really understand the solution which is being proposed there.
Compiling Stan models using rstan outside of my package works without any issues.
I would appreciate any help! If there is any more information I need to provide, I am happy to do so.
Best regards
Katrin