GitHub workflow: set RPATH to "@loader_path" / "$ORIGIN" to ensure executables and dynamic libraries search for dependencies in their origin directory. #14309
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.
(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.