NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.18k stars 13.45k forks source link

handbrake: cant build its ffmpeg #211297

Closed ghost closed 1 year ago

ghost commented 1 year ago

Describe the bug

As title says, the ffmpeg that handbrake uses can't be built, complaining about missing sdl2.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Try to install handbrake
  2. Get the error

Expected behavior

Handbrake is installable

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

error: builder for '/nix/store/l0gbll3kck6jr8f61affw0ja88znv4jk-ffmpeg-full-4.4.1.drv' failed with exit code 1;
       last 10 log lines:
       > patching file libavcodec/hevc_mp4toannexb_bsf.c
       > configuring
       > configure flags: --disable-static --prefix=/nix/store/kq9iks048pqjwvbzajvcgnsj057wva0z-ffmpeg-full-4.4.1 --target_os=linux --arch=x86_64 --enable-gpl --enable-version3 --disable-nonfree --enable-shared --enable-pic --disable-small --enable-runtime-cpudetect --disable-lto --enable-gray --enable-swscale-alpha --enable-hardcoded-tables --enable-safe-bitstream-reader --enable-pthreads --disable-w32threads --disable-os2threads --enable-network --enable-pixelutils --enable-ffmpeg --enable-ffplay --enable-ffprobe --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avutil --enable-postproc --enable-swresample --enable-swscale --enable-doc --disable-htmlpages --enable-manpages --disable-podpages --disable-txtpages --enable-bzlib --enable-libcelt --enable-cuda --enable-cuda-llvm --enable-libdav1d --disable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfreetype --enable-frei0r --enable-libfribidi --enable-libgme --enable-gnutls --enable-libgsm --enable-ladspa --enable-libmp3lame --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdc1394 --enable-libdrm --enable-iconv --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmysofa --enable-libopenmpt --enable-libopus --enable-librsvg --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvmaf --enable-libvpx --enable-libwebp --enable-xlib --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-libxml2 --enable-lzma --enable-cuvid --enable-nvdec --enable-nvenc --enable-openal --enable-opencl --enable-libopencore-amrnb --disable-opengl --enable-libopenh264 --enable-libopenjpeg --disable-openssl --enable-libpulse --enable-librav1e --enable-libsvtav1 --disable-librtmp --enable-sdl2 --enable-libsoxr --enable-libspeex --enable-libvidstab --enable-libvo-amrwbenc --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-libzimg --enable-zlib --enable-vulkan --enable-libglslang --enable-libsmbclient --disable-debug --enable-optimizations --disable-extra-warnings --disable-stripping
       > ERROR: sdl2 requested but not found
       >
       > If you think configure made a mistake, make sure you are using the latest
       > version from Git.  If the latest version fails, report the problem to the
       > ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
       > Include the log file "ffbuild/config.log" produced by configure as this will help
       > solve the problem.
       For full logs, run 'nix log /nix/store/l0gbll3kck6jr8f61affw0ja88znv4jk-ffmpeg-full-4.4.1.drv'.
error: 1 dependencies of derivation '/nix/store/yl2qnvs5i7i7l0xsms62mcim24r7pckr-handbrake-1.5.1.drv' failed to build
building '/nix/store/78k0bh5malzd32dm77nkcm56xs3m3q37-discord-0.0.22.drv'...
error: 1 dependencies of derivation '/nix/store/5b7pszn77b5n66chnl2zp6a2ikzz5q8z-handbrake-1.5.1-fish-completions.drv' failed to build

Notify maintainers

@acowley @wmertens @Anton-Latukha

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.3-zen1, NixOS, 23.05 (Stoat), 23.05pre443927.6dccdc45851`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.12.0`
 - channels(root): `"nixos"`
 - channels(m911t): `"home-manager"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
peterhoeg commented 1 year ago

Try with this patch:

diff --git a/pkgs/applications/video/handbrake/default.nix b/pkgs/applications/video/handbrake/default.nix
index 7c06f6ddb85..08a006d69b9 100644
--- a/pkgs/applications/video/handbrake/default.nix
+++ b/pkgs/applications/video/handbrake/default.nix
@@ -25,7 +25,7 @@
 , numactl
 , writeText
   # Processing, video codecs, containers
-, ffmpeg-full
+, ffmpeg_4
 , nv-codec-headers
 , libogg
 , x264
@@ -97,13 +97,13 @@ let
   # patches are required for subtitle timing to work correctly. See:
   # https://github.com/HandBrake/HandBrake/issues/4029
   ffmpeg-version = "4.4.1";
-  ffmpeg-hb = ffmpeg-full.overrideAttrs (old: {
+  ffmpeg-hb = ffmpeg_4.overrideAttrs (old: {
     version = ffmpeg-version;
     src = fetchurl {
       url = "https://www.ffmpeg.org/releases/ffmpeg-${ffmpeg-version}.tar.bz2";
       hash = "sha256-j8nyCsXtlRFanihWR63Q7t1cwamKA5raFMEyRS+YrEI=";
     };
-    patches = old.patches or [] ++ [
+    patches = old.patches or [ ] ++ [
       "${src}/contrib/ffmpeg/A01-qsv-scale-fix-green-stripes.patch"
       "${src}/contrib/ffmpeg/A02-qsv-interpolation.patch"
       "${src}/contrib/ffmpeg/A03-qsv-dx11-ffmpeg44.patch"
@@ -136,6 +136,8 @@ let
       "${src}/contrib/ffmpeg/A30-ccaption_dec-fix-pts-in-real_time-mode.patch"
       "${src}/contrib/ffmpeg/A32-qsv-fix-decode-10bit-hdr.patch"
     ];
+
+    configureFlags = lib.remove "--enable-sdl2" old.configureFlags;
   });

   versionFile = writeText "version.txt" ''
nixos-discourse commented 1 year ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/builders-unstable-cant-find-sdl2/24797/1

spikespaz commented 1 year ago
_: prev: let
  inherit (prev) lib;
in {
  handbrake = prev.handbrake.overrideAttrs (old: let
    version = "1.6.1";

    src = prev.fetchFromGitHub {
      owner = "HandBrake";
      repo = "HandBrake";
      rev = version;
      sha256 = "sha256-0MJ1inMNA6s8l2S0wnpM2c7FxOoOHxs9u4E/rgKfjJo=";
    };

    ffmpegVersion = "5.1.1";
    ffmpegPatchesDir = "${src}/contrib/ffmpeg";
    ffmpegCustom = prev.ffmpeg_5-full.overrideAttrs (old: {
      version = ffmpegVersion;
      src = prev.fetchurl {
        url = "https://www.ffmpeg.org/releases/ffmpeg-${ffmpegVersion}.tar.bz2";
        hash = "sha256-zQ4W+QNCEmbVzN3t97g7nldUrvS596fwbOnkyALwVFs=";
      };
      patches = lib.pipe ffmpegPatchesDir [
        builtins.readDir
        (lib.filterAttrs (
          name: type:
            type == "regular" && builtins.match ".+\\.patch" name != null
        ))
        (lib.mapAttrsToList (name: _: "${ffmpegPatchesDir}/${name}"))
        (patches: old.patches or [] ++ patches)
      ];
    });

    ffmpegOldName = "ffmpeg-full-4.4.1";
    ffmpegOld = lib.findSingle (p: p.name == ffmpegOldName) null null old.buildInputs;

    buildInputs = (lib.remove ffmpegOld old.buildInputs) ++ [ffmpegCustom prev.svt-av1];
  in {
    inherit version src buildInputs;
  });
}
ghost commented 1 year ago

sorry i missed this, I don't know how can I try that?

shmu26 commented 2 months ago

I am getting a similar error, after running a channel update on the unstable channel.

`ERROR: xevd >= 0.4.1 not found using pkg-config

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
error: builder for '/nix/store/lyfnfmviqby51zksk6z466pdmkqbm04h-ffmpeg-full-7.0.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/64ng1kjiz2lc8aqgyri28vs87dzfzrhj-handbrake-1.8.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/cdmnj0s57wj0q4vgrhydmvv7yby2lmxv-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/qbwvnjilsbcg2xajj3ksqi661m754y4l-nixos-system-nixos-24.11pre638038.57d6973abba7.drv' failed to build
`
natervader commented 2 months ago

Here to report the same issues, specifically seems to fail with ffmpeg-full-7.0.

Here's the errors:

error: builder for '/nix/store/lyfnfmviqby51zksk6z466pdmkqbm04h-ffmpeg-full-7.0.drv' failed with exit code 1;
       last 10 log lines:
       > Running phase: configurePhase
       > patching script interpreter paths in ./configure
       > configure flags: --disable-static --prefix=/nix/store/qfahdzg79sip3rhp72bnyl67whyb25c4-ffmpeg-full-7.0 --target_os=linux --arch=x86_64 --pkg-config=pkg-config --enable-gpl --enable-version3 --disable-nonfree --disable-static --enable-shared --enable-pic --disable-thumb --disable-small --enable-runtime-cpudetect --enable-gray --enable-swscale-alpha --enable-hardcoded-tables --enable-safe-bitstream-reader --enable-pthreads --disable-w32threads --disable-os2threads --enable-network --enable-pixelutils --datadir=/nix/store/n5r1zgf5yhrkhji2mkfmiya6jmhsb1g6-ffmpeg-full-7.0-data/share/ffmpeg --enable-ffmpeg --enable-ffplay --enable-ffprobe --bindir=/nix/store/nwrknsdv592a6k0qzs30b8wy30fbmwcq-ffmpeg-full-7.0-bin/bin --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avutil --enable-postproc --enable-swresample --enable-swscale --libdir=/nix/store/j6zk8b788zgia1cpw6wqyb2lc0vi76l7-ffmpeg-full-7.0-lib/lib --incdir=/nix/store/mh430q916hzq9zk34lifz2xfcm8wxbni-ffmpeg-full-7.0-dev/include --enable-doc --enable-htmlpages --enable-manpages --mandir=/nix/store/in3rf1rz0chkbs1yhycfy6wdqm601q69-ffmpeg-full-7.0-man/share/man --enable-podpages --enable-txtpages --docdir=/nix/store/826smq7bjdlm5118ddlb294cc6hxfwni-ffmpeg-full-7.0-doc/share/doc/ffmpeg --enable-alsa --enable-libaom --disable-appkit --enable-libaribcaption --enable-libass --disable-audiotoolbox --disable-avfoundation --enable-avisynth --enable-libbluray --enable-libbs2b --enable-bzlib --enable-libcaca --enable-libcelt --enable-chromaprint --enable-libcodec2 --disable-coreimage --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-libdav1d --enable-libdc1394 --enable-libdrm --enable-libdvdnav --enable-libdvdread --disable-libfdk-aac --enable-ffnvcodec --enable-libflite --enable-fontconfig --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libfribidi --enable-libgme --enable-gnutls --enable-libgsm --enable-libharfbuzz --enable-iconv --enable-libjack --enable-libjxl --enable-ladspa --enable-lzma --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-nvdec --enable-nvenc --enable-openal --enable-opencl --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-opengl --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-libqrencode --enable-libquirc --enable-librav1e --enable-librtmp --enable-libsmbclient --enable-sdl2 --enable-libshaderc --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-librsvg --enable-libsvtav1 --disable-libtensorflow --enable-libtheora --enable-libv4l2 --enable-v4l2-m2m --enable-vaapi --enable-vdpau --disable-libvpl --disable-videotoolbox --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-vulkan --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxcb --enable-libxcb-shape --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxevd --enable-libxeve --enable-xlib --enable-libxml2 --enable-libxvid --enable-libzimg --enable-zlib --enable-libzmq --disable-debug --enable-optimizations --disable-extra-warnings --disable-stripping
       > ERROR: xevd >= 0.4.1 not found using pkg-config
       >
       > If you think configure made a mistake, make sure you are using the latest
       > version from Git.  If the latest version fails, report the problem to the
       > ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
       > Include the log file "ffbuild/config.log" produced by configure as this will help
       > solve the problem.
       For full logs, run 'nix log /nix/store/lyfnfmviqby51zksk6z466pdmkqbm04h-ffmpeg-full-7.0.drv'.
error: 1 dependencies of derivation '/nix/store/64ng1kjiz2lc8aqgyri28vs87dzfzrhj-handbrake-1.8.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fha7z6xi08wwx00gqwxr5yjj52pijnvv-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/cwi97rcb0la390m1gm23s9wlisnxhhhw-nixos-system-NateNix-24.11.20240612.57d6973.drv' failed to build

Results of nix-shell -p nix-info --run "nix-info -m":

 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.32, NixOS, 24.11 (Vicuña), 24.11.20240612.57d6973`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"home-manager, nixos"`
 - nixpkgs: `/nix/store/dydg48djlykksz8cxq0xjplyxpa9pvf4-source`

Might be worth reopening.

SuperSandro2000 commented 2 months ago

This is a different issue and already fixed in nixos-unstable-small and should be in normal nixos-unstable shortly.

natervader commented 2 months ago

This is a different issue and already fixed in nixos-unstable-small and should be in normal nixos-unstable shortly.

Sounds great, appreciate the heads up.