Built package fails at runtime with "libc.so.6: version `GLIBC_2.34’ not found"

When trying to build ffmpeg with an overlay like this in my /etc/nixos/configuration.nix:

nixpkgs.overlays = [
  (self: super: {
    ffmpeg-headless = super.ffmpeg-headless.overrideAttrs (old: {
      version = "7.0";  # same issue when I don't override version
      preConfigure = ''
        configureFlagsArray+=(
          "--extra-cflags=-O3 -pipe -march=znver3 -ffat-lto-objects -frecord-gcc-switches"
        )
      '';
      configureFlags = old.configureFlags;
    });
  })
];

It builds successfully and tests fine during the build step, but when running ffmpeg, it fails with this error:

$ ffmpeg -h
ffmpeg: /nix/store/4s21k8k7p1mfik0b33r2spq5hq7774k1-glibc-2.33-108/lib/libc.so.6: version `GLIBC_2.34’ not found (required by /run/opengl-driver/lib/libva-drm.so.2)

I’ve seen this issue online a few places (e.g. here, here, here, and here). In a couple of those cases, unsetting LD_LIBRARY_PATH fixes the issue or restarting fixes it. In my case, this environment variable isn’t set, and restarting also doesn’t help.

It sounds like there’s a shared library that either only exists during build time, or that it can’t find on my machine at runtime, but I’m not sure how to remedy that, or avoid the issue, or why the issue occurs.

Trying to build a static ffmpeg still encounters the same issue, e.g. building with this:

nixpkgs.overlays = [
  (self: super: {
    ffmpeg-headless = super.ffmpeg-headless.overrideAttrs (old: {
      version = "7.0";  # same issue when I don't override version
      preConfigure = ''
        configureFlagsArray+=(
          "--extra-cflags=-O3 -pipe -march=znver3 -ffat-lto-objects -frecord-gcc-switches"
        )
      '';
      configureFlags = old.configureFlags;
      withStatic = true;
      withShared = false;
    });
  })
];

Does anyone have advice or knowledge about this? It seems like something that’s not uncommon for people to encounter based on internet searches, but I haven’t figured out how to remedy it in my case.

Edit: I removed this overlay and added the stock nixpkgs ffmpeg-headless to my configuration.nix and did sudo nix-store --gc ; sudo nixos-rebuild switch --upgrade. Now even the nixpkgs version throws this same error. Did I mangle something elsewhere in my environment somehow? I even rebooted for good measure.

Since the (system-wide) library libva-drm depends on GLIBC_2.34, but the shared libraries ffmpeg is running with uses a different version. (c.f. the output of running ldd on the built ffmpeg).

It’s my understanding that for ffmpeg to use this libva-drm, it’d need to be using that glibc version.

Understood! Do you know what the nixos way of reconciling this would be? e.g. is there some way I can tell it to build glibc shared libraries for both versions?

Additional strangeness: I removed the overlay and rebuilt with the stock ffmpeg-headless package, and now even that one is having the same issue. It worked before I started trying to build a custom one in the overlay.

It turns out the problem was that I installed a flake that was buggy into my nix profile a while ago and forgot it. Everything is peaches and cream now. :slight_smile: