@@ -1644,17 +1644,18 @@ impl<'a> Builder<'a> {
1644
1644
// fun to pass a flag to a tool to pass a flag to pass a flag to a tool
1645
1645
// to change a flag in a binary?
1646
1646
if self.config.rpath_enabled(target) && util::use_host_linker(target) {
1647
+ let libdir = self.sysroot_libdir_relative(compiler).to_str().unwrap();
1647
1648
let rpath = if target.contains("apple") {
1648
1649
// Note that we need to take one extra step on macOS to also pass
1649
1650
// `-Wl,-instal_name,@rpath/...` to get things to work right. To
1650
1651
// do that we pass a weird flag to the compiler to get it to do
1651
1652
// so. Note that this is definitely a hack, and we should likely
1652
1653
// flesh out rpath support more fully in the future.
1653
1654
rustflags.arg("-Zosx-rpath-install-name");
1654
- Some("-Wl,-rpath,@loader_path/../lib" )
1655
+ Some(format!( "-Wl,-rpath,@loader_path/../{}", libdir) )
1655
1656
} else if !target.contains("windows") && !target.contains("aix") {
1656
1657
rustflags.arg("-Clink-args=-Wl,-z,origin");
1657
- Some("-Wl,-rpath,$ORIGIN/../lib" )
1658
+ Some(format!( "-Wl,-rpath,$ORIGIN/../{}", libdir) )
1658
1659
} else {
1659
1660
None
1660
1661
};
0 commit comments