I want to run rust-analyzer in nvim, installed via mason.
Mason downloads the required binaries to ~/.local/share/nvim/mason/packages/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu
. As we all know, arbitrary binaries and NixOS don’t play well. Still I’m curious to understand the issue in this case.
I’m use to the linking issues which gives “No such file or directory”, but here I get another issue
$ ~/.local/share/nvim/mason/packages/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu --help
bash: /home/gdforj/.local/share/nvim/mason/packages/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu: cannot execute: required file not found
I’ve never seen that before, so I investigate
$ file ~/.local/share/nvim/mason/packages/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu
/home/gdforj/.local/share/nvim/mason/packages/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=ae6a547566c4e303e37f2a814255a46107a9519a, with debug_info, not stripped
I’m not sure I understand all of it, but at least it’s a 64-bit ELF binary executable for my platform, which should be fine.
$ ldd ~/.local/share/nvim/mason/packages/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu
linux-vdso.so.1 (0x00007ffcb4dc5000)
libgcc_s.so.1 => /nix/store/kni8lkj9hnyfvrnag648f35misbi5gja-xgcc-12.2.0-libgcc/lib/libgcc_s.so.1 (0x00007f6c39e6a000)
librt.so.1 => /nix/store/1nyg1fvhpz8bx3vn3r9f18zhra2rpbx9-glibc-2.37-8/lib/librt.so.1 (0x00007f6c39e65000)
libpthread.so.0 => /nix/store/1nyg1fvhpz8bx3vn3r9f18zhra2rpbx9-glibc-2.37-8/lib/libpthread.so.0 (0x00007f6c39e60000)
libm.so.6 => /nix/store/1nyg1fvhpz8bx3vn3r9f18zhra2rpbx9-glibc-2.37-8/lib/libm.so.6 (0x00007f6c39d80000)
libdl.so.2 => /nix/store/1nyg1fvhpz8bx3vn3r9f18zhra2rpbx9-glibc-2.37-8/lib/libdl.so.2 (0x00007f6c39d7b000)
libc.so.6 => /nix/store/1nyg1fvhpz8bx3vn3r9f18zhra2rpbx9-glibc-2.37-8/lib/libc.so.6 (0x00007f6c37c1a000)
/lib64/ld-linux-x86-64.so.2 => /nix/store/1nyg1fvhpz8bx3vn3r9f18zhra2rpbx9-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007f6c39e8d000)
There does not seem to be any issue with linking either, it finds what it needs.
In fact, LD_DEBUG
is useless because it seems to fail before it even reaches that step.
And strace
gives me that
$ strace ~/.local/share/nvim/mason/packages/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu
execve("/home/gdforj/.local/share/nvim/mason/packages/rust-analyzer/rust-analyzer-x86_64-unknown-linux-gnu", ["/home/gdforj/.local/share/nvim/m"...], 0x7ffc8e0f99b0 /* 93 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++
What kind of linuxery makes this executable not run?