Rstantools: very slow compilation with R 4.0

Yes, you need to build binary packages and place them somewhere your users can download them.
Maybe easier to do with pkgbuild like:

bin2 <- pkgbuild::build("./rstan/rstan", dest_path = tempdir(), vignettes = FALSE, manual = FALSE, binary = TRUE)

code from https://github.com/stan-dev/rstan/blob/483781fedc83558eff2ab139bab4215883c9bf52/.github/workflows/main.yml#L145

I would not put them in git as these binary packages that contain Stan files can be big, maybe rather as files on a release, kind of like we have tar.gz files here: Release v2.26.1 (17 February 2021) · stan-dev/cmdstan · GitHub (this is not a R package, just an example).

I would also suggest using Github Actions that give you free access to Windows/Mac machines (for open source). But if you have easy access to mac/win machines maybe not needed.

You can also use the drat package (https://cran.r-project.org/web/packages/drat/index.html) to make your own “CRAN”, kind of like we do for GitHub - stan-dev/r-packages: Repository for distributing (some) stan-dev R packages

and then users can install using install.packages.

Good point, will make an issue on the r-packages repo.

1 Like