Skip to content

Commit b17d4e3

Browse files
committed
auto merge of #10299 : alexcrichton/rust/osx-loader-path-fix, r=brson
According to apple's documentation of rpath semantics, `@executable_path` means that the path is relative the the *process executable*, not necessarily the library in question. On the other hand, `@loader_path` is the path that points to the library which contains the `@loader_path` reference. All of our rpath usage is based off the library or executable, not just the executable. This means that on OSX we should be using `@loader_path` instead of `@executable_path` to achieve the same 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_path` on 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.
2 parents 99e8663 + 243c0da commit b17d4e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustc/back/rpath.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn get_rpath_relative_to_output(os: session::Os,
118118
let prefix = match os {
119119
session::OsAndroid | session::OsLinux | session::OsFreebsd
120120
=> "$ORIGIN",
121-
session::OsMacos => "@executable_path",
121+
session::OsMacos => "@loader_path",
122122
session::OsWin32 => unreachable!()
123123
};
124124

@@ -241,7 +241,7 @@ mod test {
241241
let res = get_rpath_relative_to_output(o,
242242
&Path::new("bin/rustc"),
243243
&Path::new("lib/libstd.so"));
244-
assert_eq!(res.as_slice(), "@executable_path/../lib");
244+
assert_eq!(res.as_slice(), "@loader_path/../lib");
245245
}
246246
247247
#[test]

0 commit comments

Comments
 (0)