I’m encountering a new (to me) problem when trying to compile my Stan-dependent packages built with rstantools in RStudio. My workflow, following the vignette, has been:
pkgbuild::compile_dll()
roxygen2::roxygenize()
devtools::install(upgrade = FALSE)
But now compile_dll()
, which in the past has worked quickly and mostly silently, has suddenly started puking out a massive stream of warnings to the console. After several minutes of this it terminates in the following fatal error:
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr (last 10 lines):
E> make: *** [C:/R/R-40~1.5/etc/x64/Makeconf:227: stanExports_IPM_ICchinook_pp.o] Error 1
E> make: *** Waiting for unfinished jobs....
E> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/as.exe: stanExports_IPM_LCRchum_pp.o: too many sections (66611)
E> C:\Users\Buhle\AppData\Local\Temp\ccuYkIrh.s: Assembler messages:
E> C:\Users\Buhle\AppData\Local\Temp\ccuYkIrh.s: Fatal error: can't write 56 bytes to section .text of stanExports_IPM_LCRchum_pp.o: 'file too big'
E> C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/as.exe: stanExports_IPM_LCRchum_pp.o: too many sections (66611)
E> C:\Users\Buhle\AppData\Local\Temp\ccuYkIrh.s: Fatal error: can't close stanExports_IPM_LCRchum_pp.o: file too big
E> make: *** [C:/R/R-40~1.5/etc/x64/Makeconf:
[...]
What’s really baffling is that the package where this first started happening (the example shown above) had just been compiled without incident two days earlier, and literally nothing in the package code had changed, nor had I made any changes (that I’m aware of) to any relevant system files. I’ve since verified that the problem affects all my Stan / rstantools-dependent packages, including some I hadn’t touched in months. The previously compiled and installed “good” version of the package shown above still runs fine, as does rstanarm. Stan models called with rstan()
still compile and run fine.
Things I’ve tried that haven’t worked:
- Deleting the contents of the
/src
directory. - Deleting the file
C:\Users\Buhle\AppData\Local\Temp\ccuYkIrh.s
mentioned in the error message, and any other similar-looking temp files. - Calling
rstantools::rstan_config()
beforecompile_dll()
, as described here. - Checking to see if the failed compile attempt had left one of those
00-LOCK
files in mylibrary
directory (it hadn’t). - Based on the cryptic “file too big” error and this thread, adding the
-g0
flag to myMakevars.win
. - Deleting the entire contents of
Makevars.win
and just using defaults. - Uninstalling and reinstalling pkgbuild.
I haven’t yet uninstalled and reinstalled rstan and StanHeaders as mentioned here, mostly because it’s not clear to me whether the versions on mc-stan.org
are the more recent ones that might resurrect a deal-breaking issue with Stan files in RStudio that I just recently, finally, resolved.
I’d be grateful for any suggestions. As always, thanks!
Session info:
R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 compiler_4.0.5 pillar_1.5.1 prettyunits_1.1.1
[5] tools_4.0.5 pkgbuild_1.2.0 jsonlite_1.7.2 lifecycle_1.0.0
[9] tibble_3.1.0 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.10
[13] DBI_1.1.1 cli_2.4.0 parallel_4.0.5 curl_4.3
[17] loo_2.4.1 gridExtra_2.3 withr_2.4.1 dplyr_1.0.5
[21] generics_0.1.0 vctrs_0.3.7 tidyselect_1.1.0 stats4_4.0.5
[25] grid_4.0.5 glue_1.4.2 inline_0.3.17 R6_2.5.0
[29] processx_3.5.1 fansi_0.4.2 rstan_2.21.2 purrr_0.3.4
[33] ggplot2_3.3.3 callr_3.6.0 magrittr_2.0.1 codetools_0.2-18
[37] matrixStats_0.58.0 scales_1.1.1 ps_1.6.0 StanHeaders_2.21.0-7
[41] ellipsis_0.3.1 assertthat_0.2.1 colorspace_2.0-0 V8_3.4.0
[45] utf8_1.2.1 RcppParallel_5.0.3 munsell_0.5.0 crayon_1.4.1