Skip to content

Commit e326e1a

Browse files
committed
Fix rpath for libdir is specified
Signed-off-by: WANG Rui <[email protected]>
1 parent ad96323 commit e326e1a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/bootstrap/builder.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,17 +1644,18 @@ impl<'a> Builder<'a> {
16441644
// fun to pass a flag to a tool to pass a flag to pass a flag to a tool
16451645
// to change a flag in a binary?
16461646
if self.config.rpath_enabled(target) && util::use_host_linker(target) {
1647+
let libdir = self.sysroot_libdir_relative(compiler).to_str().unwrap();
16471648
let rpath = if target.contains("apple") {
16481649
// Note that we need to take one extra step on macOS to also pass
16491650
// `-Wl,-instal_name,@rpath/...` to get things to work right. To
16501651
// do that we pass a weird flag to the compiler to get it to do
16511652
// so. Note that this is definitely a hack, and we should likely
16521653
// flesh out rpath support more fully in the future.
16531654
rustflags.arg("-Zosx-rpath-install-name");
1654-
Some("-Wl,-rpath,@loader_path/../lib")
1655+
Some(format!("-Wl,-rpath,@loader_path/../{}", libdir))
16551656
} else if !target.contains("windows") && !target.contains("aix") {
16561657
rustflags.arg("-Clink-args=-Wl,-z,origin");
1657-
Some("-Wl,-rpath,$ORIGIN/../lib")
1658+
Some(format!("-Wl,-rpath,$ORIGIN/../{}", libdir))
16581659
} else {
16591660
None
16601661
};

0 commit comments

Comments
 (0)