Skip to content

Commit a3a47e9

Browse files
authored
Use macos equivalent of ORIGIN in RPATH (rust-lang#1127)
1 parent 6acc2cf commit a3a47e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

kani-compiler/build.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,11 @@ pub fn main() {
5353
let rustup_tc = env::var("RUSTUP_TOOLCHAIN").unwrap();
5454
let rustup_lib = path_str!([&rustup_home, "toolchains", &rustup_tc, "lib"]);
5555
println!("cargo:rustc-link-arg-bin=kani-compiler=-Wl,-rpath,{}", rustup_lib);
56+
5657
// While we hard-code the above for development purposes, for a release/install we look
5758
// in a relative location for a symlink to the local rust toolchain
58-
println!("cargo:rustc-link-arg-bin=kani-compiler=-Wl,-rpath,$ORIGIN/../toolchain/lib");
59+
let origin = if cfg!(target_os = "macos") { "@loader_path" } else { "$ORIGIN" };
60+
println!("cargo:rustc-link-arg-bin=kani-compiler=-Wl,-rpath,{}/../toolchain/lib", origin);
5961

6062
// Compile kani library and export KANI_LIB_PATH variable with its relative location.
6163
let out_dir = env::var("OUT_DIR").unwrap();

0 commit comments

Comments
 (0)