-
Notifications
You must be signed in to change notification settings - Fork 12.2k
GitHub workflow: set RPATH to "@loader_path" / "$ORIGIN" to ensure executables and dynamic libraries search for dependencies in their origin directory. #14309
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
base: master
Are you sure you want to change the base?
Conversation
You can test this by pushing to master in your fork. |
Thanks. It took a long time, but the 4 relevant builds did run, and some of the Windows builds failed due to build environment issues ( https://github.com/rotemdan/llama.cpp/actions/runs/15822554770 Second run (up-to-date from upstream), got same failures due to the build environment: https://github.com/rotemdan/llama.cpp/actions/runs/15823143822 When I downloaded the resulting Linux binaries and ran I don't know what can cause it, the parameters seem correct, because I've used them many times myself, locally, both in It could be something about the build environment in the fork isn't set up correctly, otherwise the Windows builds should have succeeded, since I've made no changes to them. (I've already spent more than 1/2 of the day today working exclusively on various |
My guess is that the |
…amic libraries search for dependencies in their origin directory.
4428422
to
e7cd748
Compare
Based on a suggestion from Gemini, I changed to use single quotes ( Actually, I locally always used single quotes. The only reason I changed to double quotes was because I wanted to be consistent the original workflow script. I wasn't sure if there was a difference between the two. It turns out there was. The updated run is here (I rebased with the latest changes, so recent upstream changes to https://github.com/rotemdan/llama.cpp/actions/runs/15827690592 I'll test the macOS automated builds next. Already downloaded them. |
I can't really run the macOS build, because I'm using macOS 13.0 over VMWare, which apparently is too old for them. I did verify the RPATH is set up correctly in the executables and Anyway, here are the links to the build artifacts |
(Some earlier information in related pull request: #13741)
Linux binaries
Currently the distributed Linux binaries (executables and shared libraries) default to embed an RPATH with an absolute path only relevant to the CI runner, like
/home/runner/work/llama.cpp/llama.cpp/build/bin
:This means that the binaries can only run correctly if in the current working directory, or if on system path.
If trying to run not from the current working directory, an error occurs:
After adding:
Linux binaries should include the
$ORIGIN
RPATH instead:Which resolves this issue.
Issues with Linux shared libraries
Similar issue occurs with the built shared libraries. It's difficult to use them since their search paths don't allow finding each other in the same origin directory. This resolves that as well.
macOS binaries
For macOS, the workflow already had a related build setting:
Which in practice did something similar, since no CMAKE
install
phase was likely used.It caused both the
@loader_path
and the runner absolute path to be used.I also changed to use the same approach:
Which shouldn't actually make any practical difference, except removing the absolute path.
I can't test the workflows
I hope these changes are correct, but I can't exactly test the workflows before submitting the pull request.
Order of command line arguments
I've put the new arguments at the top to be consistent with the order they were added in the macOS builds (in my personal builds I put them last actually). You can change the order in any way you want.