Skip to content

auto-patchelf: doesn't use existing RPATHs from executables #392940

Open
@corngood

Description

@corngood

Nixpkgs version

  • Unstable (25.05)

Describe the bug

According to auto-patchelf --help:

  --ignore-existing     Do not add the existing rpaths of the patched files to the list of directories to search for
                        dependencies.

This option was added in 62b6336 (Cc: @Pandapip1)

This implies that the existing RPATHs of patched files will be searched for dependencies. However, populate_cache limits itself to *.so*, so the RPATH of executables without an extension always ignored.

Steps to reproduce

$ nix build --impure --expr 'with import ./. {}; stdenvNoCC.mkDerivation { name = "test"; nativeBuildInputs = [ autoPatchelfHook ]; unpackPhase = ":"; installPhase = "install -Dm 755 ${perl}/bin/perl $out/bin/perl"; }'
error: builder for '/nix/store/qrvzl3fv0i2saaivfkyppjx93hya4jsc-test.drv' failed with exit code 1;
       last 25 log lines:
       >           PosixPath('/nix/store/h9lc1dpi14z7is86ffhl3ld569138595-audit-tmpdir.sh/lib'),
       >           PosixPath('/nix/store/m54bmrhj6fqz8nds5zcj97w9s9bckc9v-compress-man-pages.sh/lib'),
       >           PosixPath('/nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh/lib'),
       >           PosixPath('/nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh/lib'),
       >           PosixPath('/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh/lib'),
       >           PosixPath('/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh/lib'),
       >           PosixPath('/nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh/lib'),
       >           PosixPath('/nix/store/cmzya9irvxzlkh7lfy6i82gbp0saxqj3-multiple-outputs.sh/lib'),
       >           PosixPath('/nix/store/hxv896faph0rqxjq2ycxpcrbnngc95sz-patch-shebangs.sh/lib'),
       >           PosixPath('/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh/lib'),
       >           PosixPath('/nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh/lib'),
       >           PosixPath('/nix/store/z7k98578dfzi6l3hsvbivzm7hfqlk0zc-set-source-date-epoch-to-latest.sh/lib'),
       >           PosixPath('/nix/store/pilsssjjdxvdphlg2h19p0bfx5q0jzkn-strip.sh/lib')],
       >  'paths': [PosixPath('/nix/store/fb94vsj0lyk5xqd5wb7450m32j047ia4-test')],
       >  'recursive': True,
       >  'runtime_dependencies': []}
       > setting interpreter of /nix/store/fb94vsj0lyk5xqd5wb7450m32j047ia4-test/bin/perl
       > searching for dependencies of /nix/store/fb94vsj0lyk5xqd5wb7450m32j047ia4-test/bin/perl
       >     libperl.so -> not found!
       >     libcrypt.so.2 -> not found!
       > auto-patchelf: 2 dependencies could not be satisfied
       > error: auto-patchelf could not satisfy dependency libperl.so wanted by /nix/store/fb94vsj0lyk5xqd5wb7450m32j047ia4-test/bin/perl
       > error: auto-patchelf could not satisfy dependency libcrypt.so.2 wanted by /nix/store/fb94vsj0lyk5xqd5wb7450m32j047ia4-test/bin/perl
       > auto-patchelf failed to find all the required dependencies.
       > Add the missing dependencies to --libs or use `--ignore-missing="foo.so.1 bar.so etc.so"`.
       For full logs, run 'nix log /nix/store/qrvzl3fv0i2saaivfkyppjx93hya4jsc-test.drv'.

Expected behaviour

auto-patchelf should leave an executable unchanged if it's RPATH satisfies all dependencies.

Screenshots

No response

Relevant log output

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.14.0-rc7, NixOS, 25.05 (Warbler), 25.05.20250319.a84ebe2
  • multi-user?: no
  • sandbox: yes
  • version: nix-env (Nix) 2.24.12
  • channels(root): ""
  • nixpkgs: not found

Notify maintainers


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions