Use loader_path instead of executable_path for osx #10299
Closed
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.
According to apple's documentation of rpath semantics,
@executable_pathmeansthat the path is relative the the process executable, not necessarily the
library in question. On the other hand,
@loader_pathis the path that points tothe library which contains the
@loader_pathreference. All of our rpath usage isbased off the library or executable, not just the executable. This means that on
OSX we should be using
@loader_pathinstead of@executable_pathto achieve thesame semantics as linux's $ORIGIN.
The purpose of this is to unblock the current snapshot from landing. It appears that because we were propagating linker arguments we never saw this before. Now that we're no longer printing linker arguments, we're depending on the libraries to resolve their own references. In using
@executable_pathon OSX, libraries in different locations than the executable were not able to resolve their references (because their rpaths listed were all relative to the location of the library, not the executable).I'm still a little unclear on how this ever passed locally on my own machine, but it's clear why this is failing on the bots at least.