From ecec9cad3fa261c4cc2fba3479575f97c5c5c6e9 Mon Sep 17 00:00:00 2001 From: Kevin Ushey Date: Thu, 23 Jul 2026 16:09:02 -0700 Subject: [PATCH] use configure-detected TBB_LIB during install.libs At the install-libs phase, TBB_LIB was read only from the environment, which is typically unset there -- configure communicates it via make variables, not the environment. On Windows, where configure detects the Rtools copy of TBB, this meant .install.libs() wrongly took the bundled-TBB branch, shipping any stale artifacts present in tbb/build/lib_release (e.g. TBB DLLs built by RcppParallel 5.x in a long-lived working tree, masking the tbb stub library). On Linux and macOS, system-TBB builds silently shipped no libraries at all. Fall back to the configure-detected value from tbb-autodetected.R when the environment variable is unset. --- src/install.libs.R | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/install.libs.R b/src/install.libs.R index 06a7899b..e4fcec88 100644 --- a/src/install.libs.R +++ b/src/install.libs.R @@ -319,6 +319,15 @@ if (identical(args, "build")) { useBundledTbb() } } else { + + # prefer the configure-detected TBB_LIB when the environment variable + # is unset; otherwise, e.g. on Windows (where configure detects the + # Rtools copy of TBB), we'd wrongly take the bundled-TBB branch below, + # and ship any stale artifacts present in tbb/build/lib_release source("../R/tbb-autodetected.R") + if (!nzchar(tbbLib)) + tbbLib <- TBB_LIB + .install.libs(tbbLib) + }