Skip to content

Commit aae4ee3

Browse files
committed
fix installation on windows without an rtools tbb
On Windows systems whose Rtools does not provide TBB (R < 4.2.0), two code paths broke the install: - configure required cmake whenever TBB_LIB was empty, but the bundled TBB is never built on Windows; skip the cmake requirement there - the tbb stub library was built unconditionally on Windows, but tbb-compat.cpp references tbb::detail::r1::observe, which nothing provides when TBB is disabled, so the link (and thus the install) failed; the stub is also useless in that configuration, as RcppParallel.dll exports no TBB symbols for old binaries to bind
1 parent 1d452ff commit aae4ee3

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# RcppParallel (development version)
22

3+
* Fixed installation on Windows systems whose Rtools does not provide TBB
4+
(R < 4.2.0): configure no longer requires cmake there, and the tbb stub
5+
library is no longer built when the TBB backend is disabled.
6+
37
* RcppParallel now reports which TBB headers and libraries are installed
48
with the package, and from where, during package installation. In
59
addition, setting the `VERBOSE` environment variable to a value other

src/install.libs.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@
7676
}
7777

7878
# on Windows, we create a stub library that links to us so that
79-
# older binaries (like rstan) can still load
80-
if (.Platform$OS.type == "windows") {
79+
# older binaries (like rstan) can still load. this is only relevant
80+
# when TBB is available: the stub cannot link without it, and old
81+
# TBB-using binaries could not run against a TBB-less RcppParallel
82+
# regardless
83+
if (.Platform$OS.type == "windows" && TBB_ENABLED) {
8184
tbbDll <- file.path(tbbDest, "tbb.dll")
8285
if (file.exists(tbbDll)) {
8386
writeLines("** tbb.dll already exists; skipping tbb stub library")

tools/config/configure.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,10 @@ if (.Platform$OS.type == "windows") {
267267
define(PKG_LIBS = paste(pkgLibs, collapse = " "))
268268

269269
# if we're going to build tbb from sources, check for cmake
270+
# (not required on Windows, where the bundled TBB is never built;
271+
# without an Rtools TBB, the tinythread fallback is used instead)
270272
define(CMAKE = "")
271-
if (is.na(tbbLib)) {
273+
if (is.na(tbbLib) && .Platform$OS.type != "windows") {
272274

273275
cmake <- local({
274276

0 commit comments

Comments
 (0)