Can't update documentation for package using rstan

I’ve updated a function and its corresponding documentation in a package that uses rstan. When I run devtools::documentation() (or roxygen2::roxygenise()) to update the documentation a lot of text is returned the end of which reports the following error

as: stanExports_ensemble_model.o: too many sections (91332)
C:\Users\MT18\AppData\Local\Temp\cc9IYqYA.s: Assembler messages:
C:\Users\MT18\AppData\Local\Temp\cc9IYqYA.s: Fatal error: can’t write 147 bytes to section .text of stanExports_ensemble_model.o: ‘file too big’
as: stanExports_ensemble_model.o: too many sections (91332)
C:\Users\MT18\AppData\Local\Temp\cc9IYqYA.s: Fatal error: stanExports_ensemble_model.o: file too big
make: *** [C:/PROGRA~1/R/R-42~1.2/etc/x64/Makeconf:258: stanExports_ensemble_model.o] Error 1
ERROR: compilation failed for package ‘EcoEnsemble’
─ removing ‘C:/Users/MT18/AppData/Local/Temp/Rtmp2bqfiD/devtools_install_9bac480dd3b/EcoEnsemble’
Error in (function (command = NULL, args = character(), error_on_status = TRUE, …:
! System command ‘Rcmd.exe’ failed

Exit status: 1
stdout & stderr:

In this topic Pkgbuild::compile_dll() on previously working rstantools-based package fails with "file too big" error - #8 by ebuhle andrjohns suggests this is an issue with local development in rstudio in Windows. He suggested that adding

configure:

# Add configuration needed for big object files
echo "PKG_CXXFLAGS += -Wa,-mbig-obj" >> ./src/Makevars

configure.win:

# Add configuration needed for big object files
echo "PKG_CXXFLAGS += -Wa,-mbig-obj" >> ./src/Makevars.win

to the configure and configure.win files should resolve the issue. I’ve tired this but it seems to have no effect, the same error about the stanExports_ensemble_model.o file having too many sections or being ‘too big’ is returned. Any assistance on how to resolve this issue would be most appreciated.

If of interest the package in question can be found at GitHub - CefasRepRes/EcoEnsemble: R package for implementing the ensemble framework for combining ecosystem models. (branch with the changes I’ve made that have led to these issues is MT).

Session info
─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.2.2 (2022-10-31 ucrt)
os Windows 10 x64 (build 19045)
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United Kingdom.utf8
ctype English_United Kingdom.utf8
tz Europe/London
date 2024-05-13
rstudio 2022.12.0+353 Elsbeth Geranium (desktop)
pandoc NA

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
BH 1.84.0-0 2024-01-10 [1] CRAN (R 4.2.3)
cachem 1.0.8 2023-05-01 [1] CRAN (R 4.2.3)
callr 3.7.6 2024-03-25 [1] CRAN (R 4.2.3)
cli 3.6.2 2023-12-11 [1] CRAN (R 4.2.3)
codetools 0.2-18 2020-11-04 [2] CRAN (R 4.2.2)
colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.2.3)
curl 5.0.2 2023-08-14 [1] CRAN (R 4.2.3)
desc 1.4.3 2023-12-10 [1] CRAN (R 4.2.3)
devtools 2.4.5 2022-10-11 [1] CRAN (R 4.2.3)
digest 0.6.33 2023-07-07 [1] CRAN (R 4.2.3)
dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.2.3)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.3)
fansi 1.0.6 2023-12-08 [1] CRAN (R 4.2.3)
fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.2.3)
fs 1.6.3 2023-07-20 [1] CRAN (R 4.2.3)
generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.3)
ggplot2 3.5.1 2024-04-23 [1] CRAN (R 4.2.3)
glue 1.7.0 2024-01-09 [1] CRAN (R 4.2.3)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.2.3)
gtable 0.3.5 2024-04-22 [1] CRAN (R 4.2.3)
htmltools 0.5.6.1 2023-10-06 [1] CRAN (R 4.2.3)
htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.2.3)
httpuv 1.6.11 2023-05-11 [1] CRAN (R 4.2.3)
inline 0.3.19 2021-05-31 [1] CRAN (R 4.2.3)
jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.2.3)
knitr 1.44 2023-09-11 [1] CRAN (R 4.2.3)
later 1.3.1 2023-05-02 [1] CRAN (R 4.2.3)
lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.2.3)
loo 2.7.0 2024-02-24 [1] CRAN (R 4.2.3)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.3)
matrixStats 1.3.0 2024-04-11 [1] CRAN (R 4.2.3)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.3)
mime 0.12 2021-09-28 [1] CRAN (R 4.2.0)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.2.3)
munsell 0.5.1 2024-04-01 [1] CRAN (R 4.2.3)
pillar 1.9.0 2023-03-22 [1] CRAN (R 4.2.3)
pkgbuild 1.4.4 2024-03-17 [1] CRAN (R 4.2.3)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.3)
pkgload 1.3.2.1 2023-07-08 [1] CRAN (R 4.2.3)
processx 3.8.4 2024-03-16 [1] CRAN (R 4.2.3)
profvis 0.3.8 2023-05-02 [1] CRAN (R 4.2.3)
promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.3)
ps 1.7.6 2024-01-18 [1] CRAN (R 4.2.3)
purrr 1.0.2 2023-08-10 [1] CRAN (R 4.2.3)
QuickJSR 1.1.3 2024-01-31 [1] CRAN (R 4.2.3)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.3)
Rcpp 1.0.12 2024-01-09 [1] CRAN (R 4.2.3)
RcppEigen 0.3.4.0.0 2024-02-28 [1] CRAN (R 4.2.3)
RcppParallel 5.1.7 2023-02-27 [1] CRAN (R 4.2.2)
remotes 2.4.2 2021-11-30 [1] CRAN (R 4.2.3)
rlang 1.1.3 2024-01-10 [1] CRAN (R 4.2.3)
roxygen2 7.2.3 2022-12-08 [1] CRAN (R 4.2.3)
rprojroot 2.0.3 2022-04-02 [1] CRAN (R 4.2.3)
rstan 2.32.6 2024-03-05 [1] CRAN (R 4.2.3)
rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.2.3)
scales 1.3.0 2023-11-28 [1] CRAN (R 4.2.3)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.3)
shiny 1.7.4.1 2023-07-06 [1] CRAN (R 4.2.3)
StanHeaders 2.32.7 2024-04-25 [1] CRAN (R 4.2.3)
stringi 1.8.4 2024-05-06 [1] CRAN (R 4.2.2)
stringr 1.5.1 2023-11-14 [1] CRAN (R 4.2.3)
tibble 3.2.1 2023-03-20 [1] CRAN (R 4.2.3)
tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.2.3)
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.2.3)
usethis 2.2.0 2023-06-06 [1] CRAN (R 4.2.2)
utf8 1.2.4 2023-10-22 [1] CRAN (R 4.2.3)
V8 4.3.2 2023-06-30 [1] CRAN (R 4.2.3)
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.2.3)
withr 3.0.0 2024-01-16 [1] CRAN (R 4.2.3)
xfun 0.40 2023-08-09 [1] CRAN (R 4.2.3)
xml2 1.3.5 2023-07-06 [1] CRAN (R 4.2.3)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.3)

[1] C:/Users/MT18/AppData/Local/R/win-library/4.2
[2] C:/Program Files/R/R-4.2.2/library