1 diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs
2 index 73a533b5..408ab815 100644
3 --- a/src/dist/component/package.rs
4 +++ b/src/dist/component/package.rs
5 @@ -113,6 +113,7 @@ fn install<'a>(
7 builder.move_file(path.clone(), &src_path)?
9 + nix_patchelf_if_needed(&target.prefix().path().join(path.clone()), &src_path)
13 @@ -135,6 +136,29 @@ fn components(&self) -> Vec<String> {
17 +fn nix_patchelf_if_needed(dest_path: &Path, src_path: &Path) {
18 + let (is_bin, is_lib) = if let Some(p) = src_path.parent() {
19 + (p.ends_with("bin") || p.ends_with("libexec"), p.ends_with("lib"))
25 + let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
26 + .arg("--set-interpreter")
27 + .arg("@dynamicLinker@")
32 + let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
41 pub(crate) struct TarPackage<'a>(DirectoryPackage, temp::Dir<'a>);