Skip to content

Commit

Permalink
Preserving existing rpath entries
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Dec 19, 2021
1 parent aa25d34 commit 1af539a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,13 @@ impl BuildContext {

// Currently artifact .so file always resides at ${module_name}/${module_name}.so
let artifact_dir = Path::new(&self.module_name);
let new_rpath = Path::new("$ORIGIN").join(relpath(&libs_dir, artifact_dir));
// FIXME: preserving existing rpath entries
let old_rpaths = patchelf::get_rpath(artifact)?;
// TODO: clean existing rpath entries if it's not pointed to a location within the wheel
// See https://github.com/pypa/auditwheel/blob/353c24250d66951d5ac7e60b97471a6da76c123f/src/auditwheel/repair.py#L160
let mut new_rpaths: Vec<&str> = old_rpaths.split(':').collect();
let new_rpath = Path::new("$ORIGIN").join(relpath(&libs_dir, artifact_dir));
new_rpaths.push(new_rpath.to_str().unwrap());
let new_rpath = new_rpaths.join(":");
patchelf::set_rpath(artifact, &new_rpath)?;
Ok(())
}
Expand Down

0 comments on commit 1af539a

Please sign in to comment.