Commit graph build-cran-binaries/local/patches/RcppParallel
Author SHA1 Message Date
3c0459006a
fix(patches): replace the RcppParallel system-TBB patch with a link-order fix
RcppParallel 6.x rewrote its build: src/Makevars.in no longer has the
`USE_TBB=Linux` block the registry patch edited, so the patch could never
apply and every build logged "Patch for RcppParallel did not apply cleanly".

The workaround it implemented is also obsolete. 6.x bundles oneTBB 2022 and
builds it with cmake, which works on musl and with g++ 8-15, so there is no
longer a reason to link a system TBB -- and linking one publishes a binary
that needs a TBB the consumer does not have.

What is still broken upstream is the link order. configure.R names the TBB
directory with `-Wl,-L`, and gcc expands its own search dirs into `-L` options
ahead of anything forwarded verbatim with `-Wl,`, so on a build host with a
distro TBB installed `-ltbb` resolves to that library and RcppParallel.so
records its SONAME instead of the bundled `libtbb.so`. The new patch passes a
plain `-L` instead.

Verified on alpine 3.24, redhat 8 and ubuntu noble: RcppParallel gets NEEDED
libtbb.so with RPATH $ORIGIN/../lib and loads with every system libtbb moved
away, and rstan 2.32.7 compiles and loads against it with no makevars override
-- RcppParallel::CxxFlags() already emits -DTBB_INTERFACE_NEW -- so the rstan
entry is dropped too.

Summary:

- replace RcppParallel/system-tbb.patch with bundled-tbb-link-order.patch
- scope the RcppParallel entry to >=6.0.0 and widen its platforms to "*"
- drop the rstan entry, made redundant by the bundled oneTBB
- exclude local/patches/*.patch from the whitespace-mutating hooks, which
  rewrote context lines in every diff
2026-07-31 06:28:39 +00:00
6df945d147 fix(patches): build RcppParallel against system oneTBB instead of disabling TBB (#135)
All checks were successful
ci/crow/manual/weekly-audit-missing/6 Pipeline was successful
ci/crow/manual/weekly-audit-missing/7 Pipeline was successful
ci/crow/manual/weekly-audit-missing/8 Pipeline was successful
ci/crow/manual/weekly-audit-missing/9 Pipeline was successful
ci/crow/manual/weekly-audit-missing/11 Pipeline was successful
ci/crow/manual/weekly-audit-missing/12 Pipeline was successful
ci/crow/manual/weekly-audit-missing/13 Pipeline was successful
ci/crow/manual/weekly-audit-missing/14 Pipeline was successful
ci/crow/manual/weekly-audit-missing/15 Pipeline was successful
ci/crow/manual/weekly-audit-missing/16 Pipeline was successful
ci/crow/manual/weekly-audit-missing/2 Pipeline was successful
ci/crow/manual/weekly-audit-missing/10 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/4 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/5 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/3 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/7 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/6 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/11 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/13 Pipeline was successful
ci/crow/cron/process-updates/12 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/8 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/12 Pipeline was successful
ci/crow/cron/process-updates/1 Pipeline was successful
ci/crow/cron/process-updates/18 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/10 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/14 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/2 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/1 Pipeline was successful
ci/crow/cron/process-updates/17 Pipeline was successful
ci/crow/manual/weekly-rebuild-missing/9 Pipeline was successful
## What

Replace RcppParallel's `disable-tbb` registry patch with `system-tbb`: build RcppParallel against the system oneTBB instead of stripping TBB entirely.

## Why

`disable-tbb` skipped the bundled Intel TBB build by forcing the TinyThread backend, which also removed 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`.
This is the root cause behind the large "blocked on RcppParallel" / rstan clusters (issues #115, #120): the packages were not individually broken, they were all waiting on one TBB-linkage regression.

## Change

`system-tbb.patch` leaves `USE_TBB` unset (so the bundled build is still skipped on musl and g++ 15) but keeps the TBB backend and links the system oneTBB now shipped in the build-env images:

```
PKG_CXXFLAGS += -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -DTBB_INTERFACE_NEW
PKG_LIBS += -ltbb -ltbbmalloc
```

Scoped to `alpine` + `ubuntu-2604`, the only platforms where the bundled build fails; redhat and older ubuntus keep the bundled TBB.

## Requires

The companion image change that exports `TBB_INC`/`TBB_LIB` so `RcppParallelLibs()` hands the system-TBB flags to dependents: build-env-images PR #12. Both must ship together.

## Verified

In `build-env-alpine:3.24` with the new images:
- RcppParallel builds against oneTBB 2022, no ABI errors, patch applies cleanly to the target clone.
- `RcppParallelLibs()` returns `-L/usr/lib -Wl,-rpath,/usr/lib -ltbb -ltbbmalloc`.
- rstan links (`-ltbb -ltbbmalloc`) and loads with no missing symbol -- `* DONE (rstan)`, trial build exit 0.

Reviewed-on: #135
2026-07-20 09:56:21 +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