Missing libwebp.so.5?

Hello everyone!

I’m new to NixOS (and nix in general), and was trying to make a flake so that I can install Plex Desktop in a reproducible manner. It is currently missing in the nixpkgs, so I though I would give it a try to make my own derivation.

In this case, it is based on this AUR package.

This is the flake:

{
  description = "Plex Desktop Flake";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    old-nixpkgs.url = "nixpkgs/22.05"; # Latest version where libtiff.so.5 is available
  };

  outputs = { self, nixpkgs, old-nixpkgs }: 
  let 
    pkgs = import nixpkgs { system = "x86_64-linux"; };
    old-pkgs = import old-nixpkgs { system = "x86_64-linux"; };
    version = "1.97.2.190";
    name = "plex-desktop";

    plexSystem = "linux-x86_64";
    plexHash = "ca5000d0";
  in 
  {
    packages.x86_64-linux.default = pkgs.stdenv.mkDerivation {
      inherit name version;

      src = pkgs.fetchurl {
        url = "https://artifacts.plex.tv/plex-desktop-stable/${version}-${plexHash}/linux/Plex-${version}-${plexHash}-${plexSystem}.tar.bz2";
        sha256 = "sha256-IVWeL+MZUfrOZGZM4Fgo6k1F4BLC/Eye2VNYb/kh3u0=";
      };
      
      desktopItem = pkgs.fetchurl {
        url = "https://github.com/flathub/tv.plex.PlexDesktop/raw/master/tv.plex.PlexDesktop.desktop";
        sha256 = "sha256-IhX2uzorvlDOs77cuT9T0R9qUex1EvCPaK+R2oJTJhs=";
      };
      icon = pkgs.fetchurl {
        url = "https://github.com/flathub/tv.plex.PlexDesktop/raw/master/tv.plex.PlexDesktop.png";
        sha256 = "sha256-VlF4hBwxj7SSas9lpo322uSEwLcFvm3XNoWOdAiiYdU=";
      };

      nativeBuildInputs = with pkgs; [ autoPatchelfHook ];

      buildInputs = with pkgs; [ 
        hicolor-icon-theme
        alsa-lib
        dbus
        expat
        ffmpeg
        fontconfig
        freetype
        stdenv.cc.cc.lib
        harfbuzz
        lcms
        libdrm
        libjpeg8
        libwebp
        old-pkgs.libtiff
        xorg.libX11
        xorg.libxcb
        xorg.libXcomposite
        xorg.libXdamage
        xorg.libXext
        xorg.libXfixes
        libxkbcommon
        xorg.libxkbfile
        libxml2
        xorg.libXrandr
        libxslt
        xorg.libXtst
        mesa
        minizip
        nspr
        nss
        opusfile
        xorg.xcbutilrenderutil
        pciutils
        xorg.libXScrnSaver
        xorg.xcbutilimage
        xorg.libXinerama
        xorg.xcbutilkeysyms
        xorg.xcbutilwm
        xorg.libxshmfence
        zlib
        snappy
        libva
        libpulseaudio
        xorg.libXrender
        waylandpp
        qt6.qtbase
      ];

      dontWrapQtApps = true;

      unpackPhase = ''
        runHook preUnpack

        mkdir -p $out/opt/${name}
        tar --no-same-owner -xvf $src -C $out/opt/${name}

        runHook postUnpack
      '';

      installPhase = ''
        runHook preInstall

        mkdir -p $out/bin $out/share/applications $out/share/icons/hicolor/256x256/apps
        ln -s $out/opt/${name}/Plex.sh $out/bin/plex;

        cp $desktopItem $out/share/applications
        cp $icon $out/share/icons/hicolor/256x256/apps

        runHook postInstall
      '';
    };
  };
}

However, it fails with the following errors:

error: builder for '/nix/store/g8v9sv7dm49jymlrshsgvay2ffv4ibqi-plex-desktop.drv' failed with exit code 1;
       last 10 log lines:
       > setting RPATH to: /nix/store/r0n418n67p3n7642ana2nzpp1lr40zyy-libdrm-2.4.121/lib:/nix/store/vkfvl5fsb1zckfr95ymymmdg0a0wwz2j-plex-desktop/opt/plex-desktop/lib
       > searching for dependencies of /nix/store/vkfvl5fsb1zckfr95ymymmdg0a0wwz2j-plex-desktop/opt/plex-desktop/lib/dri/iHD_drv_video.so
       >     libigdgmm.so.12 -> found: /nix/store/vkfvl5fsb1zckfr95ymymmdg0a0wwz2j-plex-desktop/opt/plex-desktop/lib
       >     libgcc_s.so.1 -> found: /nix/store/7gzzk927as120sja4mwqcn28jv08q6s6-gcc-13.3.0-libgcc/lib
       > setting RPATH to: /nix/store/vkfvl5fsb1zckfr95ymymmdg0a0wwz2j-plex-desktop/opt/plex-desktop/lib:/nix/store/7gzzk927as120sja4mwqcn28jv08q6s6-gcc-13.3.0-libgcc/lib
       > auto-patchelf: 2 dependencies could not be satisfied
       > error: auto-patchelf could not satisfy dependency libwebp.so.6 wanted by /nix/store/vkfvl5fsb1zckfr95ymymmdg0a0wwz2j-plex-desktop/opt/plex-desktop/lib/libQt6WebEngineCore.so.6
       > error: auto-patchelf could not satisfy dependency libwebp.so.6 wanted by /nix/store/vkfvl5fsb1zckfr95ymymmdg0a0wwz2j-plex-desktop/opt/plex-desktop/plugins/imageformats/libqwebp.so
       > auto-patchelf failed to find all the required dependencies.
       > Add the missing dependencies to --libs or use `--ignore-missing="foo.so.1 bar.so etc.so"`.
       For full logs, run 'nix log /nix/store/g8v9sv7dm49jymlrshsgvay2ffv4ibqi-plex-desktop.drv'.

Anybody know how to fix this? I’ve already tried different versions of the libwebp package, but none of the ones available in nixpkgs seem to work… :confused:

There was a package added for it 3 weeks ago: plex-desktop: init at 1.96.0 by detroyejr · Pull Request #323397 · NixOS/nixpkgs · GitHub

You should probably just grab it from unstable until November.

1 Like

Unsure what the flatpak looks like, but when I packaged the snap application I solved this by using the version that ships with the application in usr/lib/x86_64-linux-gnu:

libwebp.so.6 ⇒ libwebp.so.6.0.2

AutoPatchElf was satisfied with this version and was able to find it when unpacked to $out/usr/lib/x86_64-linux-gnu. I don’t think I did I had to do anything for this particular library.

The LD_LIBRARY_PATH also needs to include that usr/lib folder or plex won’t launch.

PLEX_USR_PATH=${lib.makeSearchPath "usr/lib/x86_64-linux-gnu"  [ plex-desktop ]}
...
LD_LIBRARY_PATH=${lib.makeLibraryPath [ plex-desktop libglvnd-1_4_0 ]}:$PLEX_USR_PATH

Edit: The AUR you linked to has the line which might help you:

  install -Dm644 usr/lib/x86_64-linux-gnu/libwebp.so.6.0.2 ${pkgdir}/opt/${pkgname}/lib/libwebp.so.6
1 Like

Hehe, last time I check there was no package, which is probably about a month ago… I just never bothered to check again…

Thanks! Good to know anyways.