Fix macOS wheel OpenMP dependency resolution#12108
Conversation
|
Note that the wheel is used by pypi. |
There was a problem hiding this comment.
Pull request overview
Fixes macOS x86_64 wheel repair failures by ensuring the build links against a Conda-provided OpenMP runtime (avoiding Homebrew LLVM’s libunwind and its higher minimum macOS target).
Changes:
- Install
llvm-openmpin the macOS wheel build pipeline and prefer the active Conda prefix inCMAKE_PREFIX_PATH. - Update the macOS OpenMP CMake logic to prefer
libomp.dylibfromCONDA_PREFIXwhen present, with Homebrew fallback. - Extend the OpenMP RPATH patching to prioritize
$CONDA_PREFIX/libduring builds in a Conda environment.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ops/pipeline/build-python-wheels-macos.sh | Installs Conda OpenMP runtime and adjusts prefix search order for wheel builds. |
| cmake/FindOpenMPMacOS.cmake | Prefers Conda libomp and adjusts RPATH ordering to resolve OpenMP from Conda first. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Prefer Conda's OpenMP runtime for wheel builds on macOS. Homebrew's libomp can | ||
| # pull in Homebrew LLVM's libunwind, which raises the effective deployment target | ||
| # of the repaired wheel. | ||
| conda install -y llvm-openmp |
cmake/FindOpenMPMacOS.cmake
Outdated
| # - $CONDA_PREFIX/lib (when building inside a Conda environment) | ||
| # - /opt/homebrew/opt/libomp/lib (where 'brew install' / 'brew link' puts libomp.dylib) | ||
| # - ${__OpenMP_LIBRARY_DIR} (wherever find_package(OpenMP) found OpenMP at build time) | ||
| # |
|
I really don't have much experience here so feel free to take over. |
No one does. ;-( I borrowed a macbook and used another mac pro from aws at the time to see how it works ... Basically, I gave up after wasting a lot of time trying to work around it. To handle it properly, we will either:
|
|
cc @hcho3 |
Summary
This PR fixes the macOS x86_64 wheel CI failure.
The failing job was:
Build macOS wheel (macosx_x86_64)delocatefailed while repairing the wheel becauselibxgboost.dylibpicked up Homebrew LLVM'slibunwind.1.0.dylib, and that dependency requires macOS 14.0 even though the wheel target is macOS 10.15.Root Cause
On the macOS Intel runner, the wheel build was resolving OpenMP through Homebrew. That introduced a dependency on Homebrew LLVM's
libunwind, which caused wheel repair to fail with: