Skip to content

Commit

Permalink
Fix empty RPATH bug (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
io12 authored Jun 21, 2021
1 parent 4821f64 commit 0123c3a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/patch_bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ fn run_patchelf(bin: &Path, opts: &Opts) -> Result<()> {

let mut cmd = Command::new("patchelf");
cmd.arg(bin);
if let Some(lib_dir) = opts.libc.as_ref().and_then(|libc| libc.parent()) {
if let Some(lib_dir) = opts
.libc
.as_ref()
// Prepend "." in case `libc`'s `parent()` is an empty path.
.and_then(|libc| Path::new(".").join(libc).parent().map(Path::to_path_buf))
{
cmd.arg("--set-rpath").arg(lib_dir);
};
if let Some(ld) = &opts.ld {
Expand Down

0 comments on commit 0123c3a

Please sign in to comment.