Skip to content

rustup isn't patching binaries in $sysroot/libexec. #186052

@eddyb

Description

@eddyb

Describe the bug

RA (rust-analyzer, the Rust LSP, in my case used from VSCode) started erroring like this:

Failed to run proc-macro server from path
  /home/eddy/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/libexec/rust-analyzer-proc-macro-srv,
  error: Os { code: 2, kind: NotFound, message: "No such file or directory" }

I believe that libexec binary was added to Rust nightlies by @fasterthanlime's recent PR:

(I should've noticed this sooner, but I guess I hadn't updated everything involved yet?)

Steps To Reproduce

Steps to reproduce the behavior:

  1. rustup update nightly
  2. patchelf --print-interpreter $(rustc --print=sysroot)/{bin/rustc,libexec/rust-analyzer-proc-macro-srv}

Expected behavior

Binaries in bin and libexec should be patchelf'd the same way - however, what we get is:

$ patchelf --print-interpreter $(rustc --print=sysroot)/bin/rustc
/nix/store/f3qlm2873bxlhxns4lrmrinvbzn933pj-glibc-2.34-210/lib/ld-linux-x86-64.so.2
$ patchelf --print-interpreter $(rustc --print=sysroot)/libexec/rust-analyzer-proc-macro-srv
/lib64/ld-linux-x86-64.so.2

Additional context

I believe this is happening because the rustup auto-patchelf logic hardcodes bin/lib:

+ let (is_bin, is_lib) = if let Some(p) = src_path.parent() {
+ (p.ends_with("bin"), p.ends_with("lib"))

Presumably the p.ends_with("bin") there should be changed to p.ends_with("bin") || p.ends_with("libexec")?

Notify maintainers

@Mic92

Metadata

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.28, NixOS, 20.09pre-git (Nightingale), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.9.1`
 - channels(eddy): `"nixpkgs-22.11pre388097.9a17f325397"`
 - channels(root): `"nixos-20.09pre218613.ae6bdcc5358"`
 - nixpkgs: `/home/eddy/.nix-defexpr/channels/nixpkgs`

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