From 2ca4f1e7c3580b34d4a20bc905d569e8eeb2173d Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Thu, 23 Jul 2026 16:11:16 -0700 Subject: [PATCH] clean stale tbb build artifacts before shipping libraries Long-lived working trees can carry TBB libraries in src/tbb/build/lib_release from prior builds -- including from the pre-6.0 make-based build system, whose Windows DLLs (tbb.dll, tbbmalloc.dll, tbbmalloc_proxy.dll) could be swept into the installed package and mask the tbb stub library. - clear lib_release before repopulating it in useBundledTbb(), so installs ship exactly what the current build produced - enable the (previously commented-out) removal of src/tbb/build in cleanup.R; since the cmake migration, the bundled TBB is rebuilt from scratch on every install, so these artifacts are not reused anyway --- src/install.libs.R | 4 ++++ tools/config/cleanup.R | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/install.libs.R b/src/install.libs.R index e4fcec88..37c33c02 100644 --- a/src/install.libs.R +++ b/src/install.libs.R @@ -236,6 +236,10 @@ useBundledTbb <- function() { full.names = TRUE ) + # clear any artifacts from prior builds, so that we only ship + # the libraries produced by the build above + unlink("tbb/build/lib_release", recursive = TRUE) + dir.create("tbb/build/lib_release", recursive = TRUE, showWarnings = FALSE) file.copy(tbbFiles, "tbb/build/lib_release", overwrite = TRUE) unlink("tbb/build-tbb", recursive = TRUE) diff --git a/tools/config/cleanup.R b/tools/config/cleanup.R index 7746f1bc..1141a790 100644 --- a/tools/config/cleanup.R +++ b/tools/config/cleanup.R @@ -2,8 +2,11 @@ # Clean up files generated during configuration here. # Use 'remove_file()' to remove files generated during configuration. -# unlink("src/tbb/build", recursive = TRUE) -# unlink("src/tbb/build-tbb", recursive = TRUE) +# NOTE: stale artifacts in src/tbb/build can otherwise be swept into the +# installed package; the bundled TBB is rebuilt from scratch on each +# install, so nothing is lost by removing these +unlink("src/tbb/build", recursive = TRUE) +unlink("src/tbb/build-tbb", recursive = TRUE) unlink("inst/lib", recursive = TRUE) unlink("inst/libs", recursive = TRUE) unlink("inst/include/index.html", recursive = TRUE)