Skip to content

Commit 12211d4

Browse files
authored
Merge pull request #1065 from stan-dev/rtools-make-all
Expand default RTools toolchain usage to all R versions
2 parents 2fee6ca + b7634b0 commit 12211d4

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

R/install.R

+8-11
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@
2222
#' C++ toolchain. It is called internally by `install_cmdstan()` but can also
2323
#' be called directly by the user. On Windows only, calling the function with
2424
#' the `fix = TRUE` argument will attempt to install the necessary toolchain
25-
#' components if they are not found. For Windows users with RTools44 no additional
26-
#' toolchain configuration is required. For users with older versions of RTools,
27-
#' the function will install `mingw32-make` and `g++` from MSYS using the
28-
#' RTools-provided `pacman` package manager. This can also be manually requested
29-
#' by setting the environment variable `CMDSTANR_USE_MSYS_TOOLCHAIN` to 'true'
25+
#' components if they are not found. For Windows users with RTools and CmdStan
26+
#' versions >= 2.35 no additional toolchain configuration is required.
3027
#'
31-
#' NOTE: When installing CmdStan on Windows with RTools44 and CmdStan versions
28+
#' NOTE: When installing CmdStan on Windows with RTools and CmdStan versions
3229
#' prior to 2.35.0, the above additional toolchain configuration
3330
#' is still required. To enable this configuration, set the environment variable
3431
#' `CMDSTANR_USE_MSYS_TOOLCHAIN` to 'true' and call
@@ -115,9 +112,9 @@ install_cmdstan <- function(dir = NULL,
115112
.cmdstanr$WSL <- FALSE
116113
}
117114
if (os_is_windows() && !os_is_wsl() && isTRUE(version < "2.35.0")) {
118-
# RTools44 can be used unmodified with CmdStan 2.35+
115+
# RTools can be used unmodified with CmdStan 2.35+
119116
# For new installs of older versions, users need to install mingw32-make and MSYS gcc
120-
if (Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") == "" && rtools4x_version() == "44") {
117+
if (Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") == "") {
121118
stop("CmdStan versions prior to 2.35.0 require additional toolchain configuration on Windows.\n",
122119
"Please set the environment variable CMDSTANR_USE_MSYS_TOOLCHAIN to 'true' and \n",
123120
"call `check_cmdstan_toolchain(fix = TRUE)` before installing CmdStan.", call. = FALSE)
@@ -663,8 +660,8 @@ check_rtools4x_windows_toolchain <- function(fix = FALSE, quiet = FALSE) {
663660
call. = FALSE
664661
)
665662
}
666-
# No additional utilities/toolchains are needed with RTools44
667-
if (rtools4x_version() >= "44" && Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") == "") {
663+
# No additional utilities/toolchains are needed with RTools4
664+
if (Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") == "") {
668665
return(invisible(NULL))
669666
}
670667
if (!is_toolchain_installed(app = "g++", path = toolchain_path) ||
@@ -879,7 +876,7 @@ rtools4x_toolchain_path <- function() {
879876
if (arch_is_aarch64()) {
880877
toolchain <- "aarch64-w64-mingw32.static.posix"
881878
} else {
882-
if (rtools4x_version() < "44" || Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") != "" ||
879+
if (Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") != "" ||
883880
isTRUE(cmdstan_version(error_on_NA=FALSE) < "2.35.0")) {
884881
toolchain <- ifelse(is_ucrt_toolchain(), "ucrt64", "mingw64")
885882
} else {

R/utils.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ make_cmd <- function() {
9797
if (Sys.getenv("MAKE") != "") {
9898
Sys.getenv("MAKE")
9999
} else if (os_is_windows() && !os_is_wsl() &&
100-
(rtools4x_version() < "44" || Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") != "" || isTRUE(cmdstan_version(error_on_NA=FALSE) < "2.35.0"))) {
100+
(Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") != "" || isTRUE(cmdstan_version(error_on_NA=FALSE) < "2.35.0"))) {
101101
"mingw32-make.exe"
102102
} else {
103103
"make"

man/install_cmdstan.Rd

+3-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)