Skip to content

Commit

Permalink
Use macos equivalent of ORIGIN in RPATH (rust-lang#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
tedinski authored Apr 28, 2022
1 parent 6acc2cf commit a3a47e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kani-compiler/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ pub fn main() {
let rustup_tc = env::var("RUSTUP_TOOLCHAIN").unwrap();
let rustup_lib = path_str!([&rustup_home, "toolchains", &rustup_tc, "lib"]);
println!("cargo:rustc-link-arg-bin=kani-compiler=-Wl,-rpath,{}", rustup_lib);

// While we hard-code the above for development purposes, for a release/install we look
// in a relative location for a symlink to the local rust toolchain
println!("cargo:rustc-link-arg-bin=kani-compiler=-Wl,-rpath,$ORIGIN/../toolchain/lib");
let origin = if cfg!(target_os = "macos") { "@loader_path" } else { "$ORIGIN" };
println!("cargo:rustc-link-arg-bin=kani-compiler=-Wl,-rpath,{}/../toolchain/lib", origin);

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

0 comments on commit a3a47e9

Please sign in to comment.