Executables with shared libraries fail to run with err "no such file or directory"

The same thing happened in:

So there is definitely something wrong there. Both programs deal with a "net/http" server so I wonder how that relates.

That’s true. I couldn’t reproduce the error with this either, but perhaps this is not the main cause, but an rather an effect.

Here is my take on why it wasn’t working based on these two threads:

  • wrong version of glibc gets picked as an interpreter
  • this version doesn’t exist (anymore? after gc?) on the machaine
  • user tries to run the binary, but interpreter is not found
  • no such file or directory error

How to reproduce?

  • $ nix run nixpkgs#patchelf – --set-interpreter “/hello/world” ./main
  • $ ./main
  • $ zsh: no such file or directory: ./main
  • now, replace “/hello/world” with a glibc that no longer exists and you’ll have the same issue

Solutions?

  • re-install the system → correct linker gets picked
  • install another glibc → its linker gets picked? fixes the first issue? :person_shrugging: