fix(patches): build RcppParallel against system oneTBB instead of disabling TBB (#135)
Some checks failed
ci/crow/cron/process-updates/11 Pipeline failed
ci/crow/cron/process-updates/16 Pipeline was successful
ci/crow/cron/process-updates/6 Pipeline was successful
ci/crow/cron/process-updates/5 Pipeline was successful
ci/crow/manual/weekly-audit-missing/1 Pipeline was successful
ci/crow/manual/weekly-audit-missing/3 Pipeline was successful
ci/crow/manual/weekly-audit-missing/4 Pipeline was successful
ci/crow/manual/weekly-audit-missing/5 Pipeline was 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
This commit is contained in:
Patrick Schratz 2026-07-20 09:56:21 +00:00 committed by Patrick Schratz
commit 6df945d147
3 changed files with 31 additions and 21 deletions

View file

@ -1,16 +0,0 @@
diff --git a/src/Makevars.in b/src/Makevars.in
index be8445f..faee771 100644
--- a/src/Makevars.in
+++ b/src/Makevars.in
@@ -60,7 +60,10 @@ else
endif
ifeq ($(UNAME), Linux)
- USE_TBB=Linux
+ # bincraft patch: the bundled Intel TBB build hangs/fails on musl (Alpine)
+ # and newer toolchains (g++ 15). Skip it (leave USE_TBB unset) and force the
+ # TinyThread backend so RcppParallel still builds.
+ PKG_CXXFLAGS += -DRCPP_PARALLEL_USE_TBB=0
endif
ifeq ($(UNAME), SunOS)

View file

@ -0,0 +1,19 @@
diff --git a/src/Makevars.in b/src/Makevars.in
index be8445f..7cb6c9e 100644
--- a/src/Makevars.in
+++ b/src/Makevars.in
@@ -60,7 +60,13 @@ else
endif
ifeq ($(UNAME), Linux)
- USE_TBB=Linux
+ # bincraft patch: link the system oneTBB (installed in the build-env images)
+ # instead of building the bundled Intel TBB, which fails on musl (Alpine) and
+ # newer toolchains (g++ 15). Leaving USE_TBB unset skips the bundled build;
+ # -DRCPP_PARALLEL_USE_TBB=1 keeps the TBB backend so dependents (rstan, ...)
+ # link TBB, and -ltbb/-ltbbmalloc pull the system library from default paths.
+ PKG_CXXFLAGS += -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -DTBB_INTERFACE_NEW
+ PKG_LIBS += -ltbb -ltbbmalloc
endif
ifeq ($(UNAME), SunOS)

View file

@ -2,17 +2,22 @@
{
"package": "RcppParallel",
"versions": "*",
"platforms": ["alpine", "ubuntu-2604"],
"platforms": [
"alpine",
"ubuntu-2604"
],
"env": {},
"configure_args": [],
"makevars": {},
"patch": "RcppParallel/disable-tbb.patch",
"reason": "bundled Intel TBB build hangs/fails on musl (Alpine) and newer toolchains (g++ 15 on ubuntu-2604); patch unsets USE_TBB and forces -DRCPP_PARALLEL_USE_TBB=0 so RcppParallel skips the bundled build and uses the TinyThread backend"
"patch": "RcppParallel/system-tbb.patch",
"reason": "bundled Intel TBB build hangs/fails on musl (Alpine) and newer toolchains (g++ 15 on ubuntu-2604); link the system oneTBB (now in the build-env images) instead, keeping the TBB backend so dependents (rstan, ...) link TBB"
},
{
"package": "fs",
"versions": "*",
"platforms": ["*"],
"platforms": [
"*"
],
"env": {},
"configure_args": [],
"makevars": {},
@ -22,7 +27,9 @@
{
"package": "rstan",
"versions": "*",
"platforms": ["*"],
"platforms": [
"*"
],
"env": {},
"configure_args": [],
"makevars": {