-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libomp: xgboost incorrect LC_RPATH referenced in libxgboost.dylib #10946
Comments
@Ubiquitous Thank you for opening an issue. Would you like to help fix it? We are indeed having a lot of headaches with macos distribution around openmp, your expertise is appreciated. |
We merged #10440 to patch
It looks like we need to run additional command(s) to patch the rcpath as well. |
@Ubiquitous Can you try running the following command and see if that fixes the issue?
|
I also want to hear from @jameslamb about how LightGBM solved this issue. |
This doesn't sound quite right to me. Having an RPATH pointing to Homebrew's preferred location is just a hint to the loader. If you don't have OpenMP installed via Homebrew, then there shouldn't be anything found at that path, and the loader should precede to search standard system paths like Before we go any further... @Ubiquitous can you please share precisely what problem you encountered? How are you getting OpenMP and where is it installed? You just mentioned "an error" and then prescribed a solution... but the solution will depend on the specific problem you faced. Important to note that the install name for mkdir -p ./delete-me
pip download \
-d ./delete-me \
--no-deps \
--prefer-binary \
'xgboost==2.1.2'
cd ./delete-me
unzip ./xgboost*.whl
otool -l xgboost/lib/libxgboost.dylib Excerpt from that:
And output of
|
@jameslamb, I apologize for not being more clear; I installed the libomp via MacPorts, succeeded by
I used
I used
xgboost worked fine after that. I searched here in the repo for references to homebrew, which found 12 files, although it's unclear exactly where the path is getting set when My recommendation would likely be to create a different build script that takes into account possible other locations where
Since I'm running MacPorts the path where I can certainly help you resolve the issue, although there's multiple ways to attack here. Having what appears to be an exclusive dependency on Homebrew is likely the wrong approach. |
Thanks for that detail... it makes the problem and relative preference for solutions much clearer. It's not quite accurate to frame this problem as XGBoost having an "exclusive dependency on Homebrew". I strongly suspect that if you set environment variable But anyway... @hcho3 I think No shell script like #10946 (comment) (or equivalent code in any other language) should be required... just adding another RPATH entry here: xgboost/cmake/FindOpenMPMacOS.cmake Line 121 in c502bb8
How LightGBM does this: https://github.com/microsoft/LightGBM/blob/13f2e92bb0ac64f94d9b5016a33b5c34d2134204/CMakeLists.txt#L777-L782 |
@jameslamb You're welcome, and thank you for your attention on this issue. Why though does the LC_RPATH get set to |
@Ubiquitous We can do what LightGBM does, which is to specify both |
I think you are maybe misunderstanding how LC_RPATH works. You can provide multiple such paths and the loader will search them in order. Instead of saying "set to", it would be more accurate to say "has one entry pointing to". On your system, where And xgboost provides that path as a hint because it uses Homebrew to provide OpenMP in its wheel builds, xgboost/.github/workflows/python_wheels.yml Lines 33 to 34 in 3a9ce48
and because its docs recommend that users install OpenMP with homebrew. Lines 136 to 140 in 3a9ce48
I'd support |
Yes, that would work fine, thank you.
Including the additional path(s) would be great. I wasn't misunderstanding how rpath works, it just came across as if homebrew was all that was supported since it was the only rpath included. One thing to note is the homebrew path for apple intel might differ from apple silicon, although I can't confirm that, so you might want to include both of those as well perhaps if that's the case ~ tc. |
Upon installing xgboost (2.1.2) with pip on macOS (15.0.1) I noticed that there was an error related to not finding
libomp
once installed. In the installedlibxgboost.dylib
the rcpath references an absolute 'homebrew' directory (I don't use homebrew).% otool -l /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/xgboost/lib/libxgboost.dylib
It should likely be changed to use:
@rpath/libomp
unless you expect anyone who doesn't use homebrew to fix the hardcoded path anytime they install xgboost with pip.The text was updated successfully, but these errors were encountered: