Commit graph build-cran-binaries/local/patches/RcppParallel
Author SHA1 Message Date
d74424cb37
fix(patches): build RcppParallel against system oneTBB instead of disabling TBB
The disable-tbb patch skipped the bundled Intel TBB build by forcing the
TinyThread backend, which also stripped RcppParallel's TBB linkage. That
broke every dependent that links TBB through RcppParallelLibs() (rstan and
the whole Stan cluster) with 'symbol not found: tbb::detail::r1::observe'.

Replace it with system-tbb.patch: leave USE_TBB unset (so the bundled build
is skipped on musl and g++ 15) but keep the TBB backend and link the system
oneTBB that the build-env images now ship. RcppParallelLibs() then hands the
system-TBB link flags to dependents, provided TBB_INC/TBB_LIB are exported in
the images (added separately in build-env-images).

Verified in the build-env-alpine:3.24 image: RcppParallel builds against
oneTBB 2022 with no ABI errors, and rstan links (-ltbb -ltbbmalloc) and
loads without the missing-symbol error.
2026-07-19 08:39:53 +00:00
e59590e2d6 fix: RcppParallel disable-TBB source patch (env var was a no-op) (#106)
All checks were successful
ci/crow/cron/process-updates/2 Pipeline was successful
## 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.

Reviewed-on: #106
2026-06-30 13:27:01 +00:00