From 2561bed5e72efc20e706cd7d6c0c37363de1f883 Mon Sep 17 00:00:00 2001 From: pat-s Date: Tue, 14 Jul 2026 13:37:29 +0000 Subject: [PATCH] fix(patches): add rstan entry to skip removed tbb_stddef.h StanHeaders' init_threadpool_tbb.hpp unconditionally includes the legacy for TBB version detection, but that header was removed in oneTBB 2021+ (the version StanHeaders now bundles), so rstan's Module.cpp fails to compile when rstan is pulled in as a transitive dependency (e.g. of ctsem). Pre-define TBB_INTERFACE_NEW via CPPFLAGS so the header's own guard skips the removed include and selects the modern tbb/global_control.h + tbb/task_arena.h path that the bundled TBB provides. Preserve -I/usr/local/include since the CPPFLAGS override replaces the R default. --- local/patches/registry.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/local/patches/registry.json b/local/patches/registry.json index cdeef99..b1a472d 100644 --- a/local/patches/registry.json +++ b/local/patches/registry.json @@ -8,5 +8,17 @@ "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" + }, + { + "package": "rstan", + "versions": "*", + "platforms": ["*"], + "env": {}, + "configure_args": [], + "makevars": { + "CPPFLAGS": "-DTBB_INTERFACE_NEW -I/usr/local/include" + }, + "patch": null, + "reason": "StanHeaders' init_threadpool_tbb.hpp unconditionally includes the legacy (removed in oneTBB 2021+) for version detection, breaking compilation of Module.cpp against the bundled oneTBB. Pre-defining TBB_INTERFACE_NEW skips that include and selects the modern tbb/global_control.h + tbb/task_arena.h path that the bundled TBB provides (-I/usr/local/include preserves the default CPPFLAGS the override replaces)" } ]