How to deal with `/lib64/ld-linux-x86-64.so.2` missing on NixOS?

I’m trying to run julia on NixOS, and I just came across an issue where calling Plots.mp4(anim, "foobar.mp4") errors out because the julia Plots.jl package brings in its own ffmpeg binary to ~/.julia/artifacts/7f40eeb66d90d3026ae5fb68761c263b57adb840/bin/ffmpeg and it doesn’t seem to be compatible with NixOS. Running this binary I get,

$ ./ffmpeg
bash: ./ffmpeg: No such file or directory

Ok, so what does file have to say?

$ file ffmpeg
ffmpeg: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.4.0, stripped

So as best as I can tell the issue is that /lib64/ld-linux-x86-64.so.2 doesn’t exist on NixOS systems.

What’s the recommended workaround for these scenarios? I’m open to hacky-ish ideas…

EDIT: created an issue on the Plots.jl project here: [BUG] `Plots.mp4` does not work on NixOS · Issue #3271 · JuliaPlots/Plots.jl · GitHub

I built GitHub - Mic92/nix-ld: Run unpatched dynamic binaries on NixOS to cope with this. See the two examples on how to use it.

3 Likes

The alternative is fhsuserenv. You can find a few examples here: GitHub - nix-community/nix-environments: Repository to maintain out-of-tree shell.nix files (maintainer=@mic92)

2 Likes

Packaging/Binaries - NixOS Wiki gives you some general knowledge on the topic. As well as autopatchelf - what it can look like | Farid Zakaria’s Blog and GitHub - Lassulus/nix-autobahn

2 Likes

Thank you so much @Mic92! This is all super helpful.