fix: RcppParallel disable-TBB source patch (env var was a no-op) #106

Merged
pat-s merged 1 commit from fix/rcppparallel-disable-tbb into main 2026-06-30 13:27:01 +00:00
Owner

Summary

Fixes the RcppParallel patch, which was a no-op and left the build hanging.

The previous registry entry set env: { RCPP_PARALLEL_USE_TBB: "0" }. But RCPP_PARALLEL_USE_TBB is a compile-time -D flag in RcppParallel's Makevars — it is never read from the environment. So the override did nothing: USE_TBB=Linux (hardcoded from uname) still triggered the bundled Intel TBB build, which hangs/fails on musl (Alpine) and newer toolchains (g++ 15 on ubuntu-2604). The Applying patch … log only meant the env was set, not that it had any effect.

Fix

Replace the env entry with a source patch (local/patches/RcppParallel/disable-tbb.patch) on src/Makevars.in that, on Linux:

  • leaves USE_TBB unset → the whole bundled-TBB build/link path is skipped (no hang), and
  • forces PKG_CXXFLAGS += -DRCPP_PARALLEL_USE_TBB=0 → the sources compile the TinyThread backend (needed because RcppParallel.h otherwise auto-defaults TBB on for glibc Linux).

Verification

In a Linux container, applying the patch and running R CMD INSTALL RcppParallel:

bundled_TBB_build=0      # bundled TBB build never runs
* DONE (RcppParallel)    # installs via TinyThread

Note

bincraft's apply_source_patch shells out to patch. If a build-env image lacks the patch tool (common on Alpine), the patch will report "did not apply cleanly" and fall back to an unpatched (hanging) build. If that happens, the follow-up is to switch bincraft's patch application to git apply (git is always present) — happy to do that if needed.

## Summary Fixes the RcppParallel patch, which was a **no-op** and left the build hanging. The previous registry entry set `env: { RCPP_PARALLEL_USE_TBB: "0" }`. But `RCPP_PARALLEL_USE_TBB` is a **compile-time `-D` flag** in RcppParallel's Makevars — it is never read from the environment. So the override did nothing: `USE_TBB=Linux` (hardcoded from `uname`) still triggered the **bundled Intel TBB build**, which hangs/fails on musl (Alpine) and newer toolchains (g++ 15 on ubuntu-2604). The `Applying patch …` log only meant the env was set, not that it had any effect. ## Fix Replace the env entry with a **source patch** (`local/patches/RcppParallel/disable-tbb.patch`) on `src/Makevars.in` that, on Linux: - leaves `USE_TBB` unset → the whole bundled-TBB build/link path is skipped (no hang), and - forces `PKG_CXXFLAGS += -DRCPP_PARALLEL_USE_TBB=0` → the sources compile the **TinyThread** backend (needed because `RcppParallel.h` otherwise auto-defaults TBB on for glibc Linux). ## Verification In a Linux container, applying the patch and running `R CMD INSTALL RcppParallel`: ``` bundled_TBB_build=0 # bundled TBB build never runs * DONE (RcppParallel) # installs via TinyThread ``` ## Note bincraft's `apply_source_patch` shells out to `patch`. If a build-env image lacks the `patch` tool (common on Alpine), the patch will report "did not apply cleanly" and fall back to an unpatched (hanging) build. If that happens, the follow-up is to switch bincraft's patch application to `git apply` (git is always present) — happy to do that if needed.
The previous entry set env RCPP_PARALLEL_USE_TBB=0, but RcppParallel reads that
only as a compile -D flag, not from the environment — so it was a no-op and the
bundled Intel TBB build still ran (and hung on musl / newer toolchains).

Replace it with a source patch on src/Makevars.in that leaves USE_TBB unset
(skipping the bundled TBB build) and forces -DRCPP_PARALLEL_USE_TBB=0 so the
sources use the TinyThread backend. Verified in a Linux container: RcppParallel
installs with no bundled-TBB build (* DONE (RcppParallel)).
pat-s merged commit e59590e2d6 into main 2026-06-30 13:27:01 +00:00
pat-s deleted branch fix/rcppparallel-disable-tbb 2026-06-30 13:27:02 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
devxy/build-cran-binaries!106
No description provided.