stan-dev / stan-dev/rstanarm

Struggling to build from source with R 4.2.1

Open
#568 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
401
Forks
136
PR merge metrics
No merged PRs in 30d

Description

Summary:

Struggling to build rstanarm from source. I'm trying to bring the latest changes from master into the feature/survival branch and then build the package on Windows using R 4.2.1 and Rtools42. See the bottom of this post for my full traceback. Error feels familiar, but then again... 🤔

I want to get this build working with R 4.2 to try and start unblocking all the issues people are describing in #500.

Reproducible Steps:
  1. Clone the survival_2_21_3 branch: https://github.com/stan-dev/rstanarm/tree/survival_2_21_3
  2. Run roxygen2::roxygenize() on R 4.2.1 with Rtools42
RStanARM Version:

survival_2_21_3 branch

R Version:

4.2.1

Operating System:

Windows 11

> roxygen2::roxygenize()
ℹ Loading rstanarm
Re-compiling rstanarm
─  installing *source* package 'rstanarm' ...
   ** using staged installation
   Loading required package: Rcpp
   Loading required package: bayesplot
   This is bayesplot version 1.9.0
   - Online documentation and vignettes at mc-stan.org/bayesplot
   - bayesplot theme set to bayesplot::theme_default()
      * Does _not_ affect other ggplot2 plots
      * See ?bayesplot_theme_set for details on theme setting
   Loading required package: ggplot2
   Loading required package: lme4
   Loading required package: Matrix
   Loading required package: loo
   This is loo version 2.5.1
   - Online documentation and vignettes at mc-stan.org/loo
   - As of v2.0.0 loo defaults to 1 core but we recommend using as many as possible. Use the 'cores' argument or set options(mc.cores = NUM_CORES) for an entire session. 
   - Windows 10 users: loo may be very slow if 'mc.cores' is set in your .Rprofile file (see https://github.com/stan-dev/loo/issues/94).
   Loading required package: nlme
   
   Attaching package: 'nlme'
   
   The following object is masked from 'package:lme4':
   
       lmList
   
   Loading required package: rstan
   Loading required package: StanHeaders
   rstan (Version 2.21.5, GitRev: 2e1f913d3ca3)
   For execution on a local, multicore CPU with excess RAM we recommend calling
   options(mc.cores = parallel::detectCores()).
   To avoid recompilation of unchanged Stan programs, we recommend calling
   rstan_options(auto_write = TRUE)
   Do not specify '-march=native' in 'LOCAL_CPPFLAGS' or a Makevars file
   Loading required package: rstantools
   This is rstantools version 2.2.0
   Loading required package: shinystan
   Loading required package: shiny
   
   This is shinystan version 2.6.0
   
   Loading required package: splines
   Loading required package: splines2
   Loading required package: survival
   Loading required package: RcppParallel
   
   Attaching package: 'RcppParallel'
   
   The following object is masked from 'package:Rcpp':
   
       LdFlags
   
   Warning: [posterior_survfit.R:299] @examples has mismatched braces or quotes
   Warning: [posterior_survfit.R:1131] @examples has mismatched braces or quotes
   Warning: [posterior_traj.R:183] @examples has mismatched braces or quotes
   Warning: [posterior_traj.R:555] @examples has mismatched braces or quotes
   Warning: [ps_check.R:71] @examples has mismatched braces or quotes
   Writing 'NAMESPACE'
   Writing 'NAMESPACE'
   Writing 'as.matrix.stanreg.Rd'
   Writing 'bayes_R2.stanreg.Rd'
   Writing 'QR-argument.Rd'
   Writing 'adapt_delta.Rd'
   Writing 'available-algorithms.Rd'
   Writing 'rstanarm-datasets.Rd'
   Writing 'example_jm.Rd'
   Writing 'example_model.Rd'
   Writing 'available-models.Rd'
   Writing 'rstanarm-deprecated.Rd'
   Writing 'rstanarm-package.Rd'
   Writing 'reexports.Rd'
   Writing 'launch_shinystan.stanreg.Rd'
   Writing 'log_lik.stanreg.Rd'
   Writing 'kfold.stanreg.Rd'
   Writing 'loo_predict.stanreg.Rd'
   Writing 'loo.stanreg.Rd'
   Writing 'logit.Rd'
   Writing 'get_y.Rd'
   Writing 'get_surv.Rd'
   Writing 'neg_binomial_2.Rd'
   Writing 'plot.stanreg.Rd'
   Writing 'pairs.stanreg.Rd'
   Writing 'posterior_interval.stanreg.Rd'
   Writing 'posterior_linpred.stanreg.Rd'
   Writing 'posterior_predict.stanreg.Rd'
   Writing 'posterior_survfit.Rd'
   Writing 'print.survfit.stansurv.Rd'
   Writing 'plot.survfit.stanjm.Rd'
   Writing 'posterior_traj.Rd'
   Writing 'plot.predict.stanjm.Rd'
   Writing 'posterior_vs_prior.Rd'
   Writing 'pp_check.stanreg.Rd'
   Writing 'pp_validate.Rd'
   Writing 'predict.stanreg.Rd'
   Writing 'predictive_error.stanreg.Rd'
   Writing 'predictive_interval.stanreg.Rd'
   Writing 'print.stanreg.Rd'
   Writing 'summary.stanreg.Rd'
   Writing 'prior_summary.stanreg.Rd'
   Writing 'priors.Rd'
   Writing 'ps_check.Rd'
   Writing 'stan_lm.Rd'
   Writing 'stan_betareg.Rd'
   Writing 'stan_biglm.Rd'
   Writing 'stan_clogit.Rd'
   Writing 'stan_gamm4.Rd'
   Writing 'stan_glm.Rd'
   Writing 'stan_glmer.Rd'
   Writing 'stan_jm.Rd'
   Writing 'stan_mvmer.Rd'
   Writing 'stan_nlmer.Rd'
   Writing 'stan_polr.Rd'
   Writing 'stan_surv.Rd'
   Writing 'tve.Rd'
   Writing 'stanmvreg-methods.Rd'
   Writing 'terms.stanmvreg.Rd'
   Writing 'family.stanmvreg.Rd'
   Writing 'model.frame.stanmvreg.Rd'
   Writing 'stanreg-methods.Rd'
   Writing 'se.Rd'
   Writing 'family.stanreg.Rd'
   Writing 'model.frame.stanreg.Rd'
   Writing 'model.matrix.stanreg.Rd'
   Writing 'formula.stanreg.Rd'
   Writing 'terms.stanreg.Rd'
   Writing 'stanreg-objects.Rd'
   Writing 'stanreg_list.Rd'
   cp: cannot overwrite non-directory 'tests/testthat/stan_files' with directory 'src/stan_files'
   cp: cannot overwrite non-directory 'tests/testthat/include' with directory 'inst/include'
   ** libs
   "C:/PROGRA~1/R/R-42~1.1/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/bernoulli.stan
   Wrote C++ file "stan_files/bernoulli.cc"
   
   
   g++  -std=gnu++14 -I"C:/PROGRA~1/R/R-42~1.1/include" -DNDEBUG -I"../inst/include" -I"C:/Program Files/R/R-4.2.1/library/StanHeaders/include/src" -DBOOST_DISABLE_ASSERTS -DEIGEN_NO_DEBUG -I'C:/Program Files/R/R-4.2.1/library/StanHeaders/include' -I'C:/Program Files/R/R-4.2.1/library/rstan/include' -I'C:/Program Files/R/R-4.2.1/library/BH/include' -I'C:/Program Files/R/R-4.2.1/library/Rcpp/include' -I'C:/Program Files/R/R-4.2.1/library/RcppEigen/include' -I'C:/Program Files/R/R-4.2.1/library/RcppParallel/include'   -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"  `"C:/PROGRA~1/R/R-42~1.1/bin/x64/Rscript" -e "RcppParallel::CxxFlags()"` `"C:/PROGRA~1/R/R-42~1.1/bin/x64/Rscript" -e "StanHeaders:::CxxFlags()"` -flto=jobserver   -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -UNDEBUG -Wall -pedantic -g -O0 -fdiagnostics-color=always -c stan_files/bernoulli.cc -o stan_files/bernoulli.o
   g++.exe:error: Files/R/R-4.2.1/library/RcppParallel/include": No such file or directory
   make: *** [C:/PROGRA~1/R/R-42~1.1/etc/x64/Makeconf:258: stan_files/bernoulli.o] Error 1
   rm stan_files/bernoulli.cc
   ERROR: compilation failed for package 'rstanarm'
─  removing 'C:/Users/SBRILL~1/AppData/Local/Temp/RtmpCM60dL/devtools_install_212818dd7db2/rstanarm'
Error in `(function (command = NULL, args = character(), error_on_status = TRUE, …`:
! System command 'Rcmd.exe' failed
---
Exit status: 1
stdout & stderr: <printed>
---
Type .Last.error to see the more details.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated compile command in the traceback and inspect tools/make_cc.R, the RcppParallel::CxxFlags() output, and the paths under tests/testthat/stan_files, src/stan_files, and inst/include. Reproduce the source build on Windows with R 4.2.1 and Rtools42, then verify that the package compiles without the reported include-path and copy errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.