I have created a R library via RStudio and have added Stan infrastructure to it, using
library(rstantools)
rstantools::use_rstan().
The development version of the package is available on Github (here). Before adding the Stan infrastructure, performing a R CMD check
would be concluded with no errors.
Having executed rstantools::use_rstan()
, I add the following lines to the R/Bernadette-package.R file, as instructed, since I am using roxygen:
#' @useDynLib bernadette, .registration=TRUE
#' @import Rcpp
#' @importFrom rstan sampling vb
Then, I perform a devtools::check()
again. Execution fails, here is the error mesage:
i Updating Bernadette documentation
i Loading Bernadette
Re-compiling Bernadette
- installing *source* package 'Bernadette' ... (349ms)
** using staged installation
** libs
no DLL was created
ERROR: compilation failed for package 'Bernadette'
- removing 'C:/Users/lbour/AppData/Local/Temp/RtmpAbbTwb/devtools_install_23f468b66d4e/Bernadette'
Error: System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
E> * installing *source* package 'Bernadette' ...
E> ** using staged installation
E> ** libs
E> no DLL was created
E> ERROR: compilation failed for package 'Bernadette'
E> * removing 'C:/Users/lbour/AppData/Local/Temp/RtmpAbbTwb/devtools_install_23f468b66d4e/Bernadette'
Stack trace:
1. devtools::check(, check_dir = dirname(getwd()))
2. devtools:::document(pkg, quiet = quiet)
3. roxygen2::roxygenise(pkg$path, roclets)
4. roxygen2:::load_code(base_path)
5. pkgload::load_all(path, helpers = FALSE, attach_testthat = FALSE)
6. pkgbuild::compile_dll(path, quiet = quiet)
7. pkgbuild:::install_min(path, dest = install_dir, components = "li ...
8. pkgbuild:::rcmd_build_tools("INSTALL", c(path, paste("--library=" ...
9. pkgbuild:::with_build_tools(callr::rcmd_safe(..., env = env, ...
10. withr::with_path(rtools_path(), code)
11. base:::force(code)
12. callr::rcmd_safe(..., env = env, spinner = FALSE, show = FALSE, ...
13. callr:::run_r(options)
14. base:::with(options, with_envvar(env, do.call(processx::run, ...
15. base:::with.default(options, with_envvar(env, do.call(processx::r ...
16. base:::eval(substitute(expr), data, enclos = parent.frame())
17. base:::eval(substitute(expr), data, enclos = parent.frame())
18. callr:::with_envvar(env, do.call(processx::run, c(list(bin, args ...
19. base:::force(code)
20. base:::do.call(processx::run, c(list(bin, args = real_cmdargs, ...
21. (function (command = NULL, args = character(), error_on_status = TRUE, ...
22. throw(new_process_error(res, call = sys.call(), echo = echo, ...
x System command 'Rcmd.exe' failed, exit status: 1, stdout + stderr:
E> * installing *source* package 'Bernadette' ...
E> ** using staged installation
E> ** libs
E> no DLL was created
E> ERROR: compilation failed for package 'Bernadette'
E> * removing 'C:/Users/lbour/AppData/Local/Temp/RtmpAbbTwb/devtools_install_23f468b66d4e/Bernadette'
Execution halted
Exited with status 1.
I have spent some time to find a solution, both at this forum and elsewhere, but no luck so far. Can you please advise on how to resolve this? Here is my local machine configuration, with RStudio 1.4.1106 and RTools 3.5:
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Greek_Greece.1253 LC_CTYPE=Greek_Greece.1253 LC_MONETARY=Greek_Greece.1253
[4] LC_NUMERIC=C LC_TIME=Greek_Greece.1253
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstantools_2.1.1 Bernadette_0.1.0
loaded via a namespace (and not attached):
[1] Rcpp_1.0.6 lubridate_1.7.10 lattice_0.20-44 prettyunits_1.1.1
[5] ps_1.6.0 assertthat_0.2.1 rprojroot_2.0.2 utf8_1.2.1
[9] V8_3.4.2 R6_2.5.0 stats4_3.6.0 ggplot2_3.3.4
[13] pillar_1.6.1 rlang_0.4.11 curl_4.3.1 rstudioapi_0.13
[17] callr_3.7.0 Matrix_1.3-3 desc_1.3.0 devtools_2.4.1
[21] readr_1.4.0 RcppEigen_0.3.3.9.1 scoringRules_1.0.1 loo_2.4.1
[25] munsell_0.5.0 compiler_3.6.0 xfun_0.24 rstan_2.21.2
[29] pkgconfig_2.0.3 pkgbuild_1.2.0 tidyselect_1.1.1 tibble_3.1.2
[33] gridExtra_2.3 codetools_0.2-18 matrixStats_0.59.0 fansi_0.5.0
[37] crayon_1.4.1 dplyr_1.0.7 withr_2.4.2 MASS_7.3-54
[41] BH_1.75.0-0 grid_3.6.0 jsonlite_1.7.2 gtable_0.3.0
[45] lifecycle_1.0.0 DBI_1.1.1 magrittr_2.0.1 StanHeaders_2.21.0-7
[49] scales_1.1.1 RcppParallel_5.1.4 cli_2.5.0 cachem_1.0.5
[53] remotes_2.3.0 fs_1.5.0 testthat_3.0.2 ellipsis_0.3.2
[57] generics_0.1.0 vctrs_0.3.8 tools_3.6.0 glue_1.4.2
[61] purrr_0.3.4 hms_1.1.0 processx_3.5.2 pkgload_1.2.1
[65] parallel_3.6.0 fastmap_1.1.0 inline_0.3.19 colorspace_2.0-1
[69] sessioninfo_1.1.1 memoise_2.0.0 knitr_1.33 usethis_2.0.1
Thank you in advance,
Lampros