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
This commit is contained in:
parent
8d0c4b7ccd
commit
3c0459006a
2 changed files with 61 additions and 45 deletions
46
local/patches/RcppParallel/bundled-tbb-link-order.patch
Normal file
46
local/patches/RcppParallel/bundled-tbb-link-order.patch
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
diff --git a/tools/config/configure.R b/tools/config/configure.R
|
||||
index 6293fe1..2f84337 100644
|
||||
--- a/tools/config/configure.R
|
||||
+++ b/tools/config/configure.R
|
||||
@@ -186,12 +186,23 @@ define(
|
||||
)
|
||||
|
||||
# set PKG_LIBS
|
||||
+#
|
||||
+# bincraft patch: the library directories below are passed as plain '-L', not
|
||||
+# '-Wl,-L'. gcc expands its own search dirs (/usr/lib64, /usr/lib/<triplet>)
|
||||
+# into explicit '-L' options ahead of anything forwarded verbatim with '-Wl,',
|
||||
+# so with '-Wl,-L' a system libtbb.so wins over the one named here: on a build
|
||||
+# host with a distro TBB installed, '-ltbb' resolves to that library and
|
||||
+# RcppParallel.so records its SONAME (libtbb.so.12, or libtbb.so.2 for the
|
||||
+# classic Intel TBB) instead of the bundled 'libtbb.so'. The binary then loads
|
||||
+# the system TBB rather than the copy shipped in RcppParallel/lib, and fails
|
||||
+# outright on a machine that has no system TBB. gcc places a plain '-L' before
|
||||
+# its built-in dirs, so the intended library is found first.
|
||||
pkgLibs <- if (!is.na(tbbLib)) {
|
||||
|
||||
# a TBB supplied via TBB_LIB / TBB_ROOT. an rpath is meaningless on Windows,
|
||||
# where the loader has no equivalent -- see R/zzz.R for how we resolve there
|
||||
c(
|
||||
- "-Wl,-L\"$(TBB_LIB)\"",
|
||||
+ "-L\"$(TBB_LIB)\"",
|
||||
if (.Platform$OS.type != "windows")
|
||||
sprintf("-Wl,-rpath,%s", shQuote(tbbLib)),
|
||||
"-l$(TBB_NAME)",
|
||||
@@ -201,14 +212,14 @@ pkgLibs <- if (!is.na(tbbLib)) {
|
||||
} else if (R.version$os == "emscripten") {
|
||||
|
||||
c(
|
||||
- "-Wl,-Ltbb/build/lib_release",
|
||||
+ "-Ltbb/build/lib_release",
|
||||
"-l$(TBB_NAME)"
|
||||
)
|
||||
|
||||
} else {
|
||||
|
||||
c(
|
||||
- "-Wl,-Ltbb/build/lib_release",
|
||||
+ "-Ltbb/build/lib_release",
|
||||
"-l$(TBB_NAME)",
|
||||
"-l$(TBB_MALLOC_NAME)"
|
||||
)
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
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)
|
||||
Loading…
Reference in a new issue