diff --git a/templates/usr/local/bin/R-install-package.j2 b/templates/usr/local/bin/R-install-package.j2 index f47c7bc..0e992c9 100644 --- a/templates/usr/local/bin/R-install-package.j2 +++ b/templates/usr/local/bin/R-install-package.j2 @@ -19,6 +19,15 @@ if (type == 'github') { if (!(package %in% installed.packages(lib.loc = lib)[, 'Package'])) { if (type == 'cran') { repos = ifelse(is.na(argv[4]), '{{ r_packages_repos.rstrip('/') }}', argv[4]); + + # Temporary fix for: https://github.com/r-lib/xml2/issues/231 + if (package %in% c('devtools', 'xml2')) { + if (!('withr' %in% installed.packages(lib.loc = lib)[, 'Package'])) { + install.packages(p, lib, repos) + } + withr::with_makevars(c(CXX = 'g++ -std=c++11'), install.packages('xml2', lib, repos)) + } + withCallingHandlers({ install.packages(package, lib, repos); cat("changed\n");