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.
let prefix = match os {
session::OsAndroid | session::OsLinux | session::OsFreebsd
=> "$ORIGIN",
- session::OsMacos => "@executable_path",
+ session::OsMacos => "@loader_path",
session::OsWin32 => unreachable!()
};
let res = get_rpath_relative_to_output(o,
&Path::new("bin/rustc"),
&Path::new("lib/libstd.so"));
- assert_eq!(res.as_slice(), "@executable_path/../lib");
+ assert_eq!(res.as_slice(), "@loader_path/../lib");
}
#[test]