fix bundled tbb build issues on macos#247
Merged
Merged
Conversation
- disable oneTBB's automatic hwloc search, so the optional tbbbind library is no longer built; its link fails on the CRAN macOS machines, where a static hwloc is discoverable via pkg-config but its required frameworks are not on the link line - build the bundled oneTBB with __TBB_RESUMABLE_TASKS_USE_THREADS on macOS, avoiding the deprecated ucontext APIs (getcontext, swapcontext, makecontext)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the RcppParallel build failure on the CRAN macOS machines
(https://www.r-project.org/nosvn/R.check/r-release-macos-arm64/RcppParallel-00install.html),
and resolves the
getcontext/swapcontext/makecontextdeprecation warnings there.tbbbind link failure
oneTBB's CMake automatically searches for hwloc via pkg-config and, if found, builds the
optional
tbbbindNUMA-support library. The CRAN macOS machines now have a static-onlyhwloc discoverable via pkg-config, but
pkg_search_module()requests the shared-link flags,which omit the
Libs.privateframeworks (CoreFoundation, IOKit, OpenCL) required whenlinking hwloc statically. The
tbbbind_2_5link then fails with undefined symbols.RcppParallel doesn't use TBB's NUMA APIs (and
libtbbonly ever loads tbbbind lazily viadlopen, falling back gracefully when absent), so we now pass-DTBB_DISABLE_HWLOC_AUTOMATIC_SEARCH=1and skip tbbbind entirely. This also makes thebuild deterministic regardless of what's installed on the build machine, and avoids shipping
a
libtbbbindbound to a build-machine hwloc that wouldn't exist on user machines.ucontext deprecation warnings
The ucontext APIs used by oneTBB's coroutine implementation for resumable tasks have been
deprecated on macOS since 10.6. We now build the bundled oneTBB with
-D__TBB_RESUMABLE_TASKS_USE_THREADS=1on macOS, selecting oneTBB's threads-basedcoroutine implementation (the same code path upstream uses under sanitizers), so the
deprecated APIs are no longer referenced at all.
Testing
R CMD INSTALL --precleanon macOS arm64 succeeds; CMake logs confirm no tbbbindtargets are created and the define is applied to all TBB compile lines.
nm -u libtbb.dylibshows no_getcontext/_swapcontext/_makecontextreferences(previously present).
libtbb.dylib,libtbbmalloc.dylib,libtbbmalloc_proxy.dylib;package loads and
setThreadOptions()/defaultNumThreads()work.