NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.06k stars 14.1k forks source link

Build failure: libdevil (affects ffmpeg-full) #309417

Closed peterldowns closed 6 months ago

peterldowns commented 6 months ago

Steps To Reproduce

On MacOS Sonoma 14.4.1 on an M1 Macbook Pro, with nixpkgs pinned at ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d, building ffmpeg-full fails when compiling libdevil-1.7.8:

nix build github:NixOS/nixpkgs/ee4a6e0f566fe5ec79968c57a9c2c3c25f2cf41d#ffmpeg-full

Build log

Full log available at this gist, but here's an excerpt of the failures from the nix build command:

error: builder for '/nix/store/v9y75pbzyz6bdv44rpvgwhf1h7ykxpi4-libdevil-1.7.8.drv' failed with exit code 2;
       last 10 log lines:
       >         if (strncmp(Header->Signature, "DICM", 4))
       >                     ^~~~~~~~~~~~~~~~~
       > /nix/store/c7br4l9dgy35giv0zdj70jw0bnkqgwsc-libSystem-11.0.0/include/string.h:84:26: note: passing argument to parameter '__s1' here
       > int      strncmp(const char *__s1, const char *__s2, size_t __n);
       >                              ^
       > 1 warning generated.
       > 3 warnings generated.
       > 4 warnings generated.
       > make[1]: Leaving directory '/private/tmp/nix-build-libdevil-1.7.8.drv-5/devil-1.7.8/lib'
       > make: *** [Makefile:322: all-recursive] Error 1
       For full logs, run 'nix log /nix/store/v9y75pbzyz6bdv44rpvgwhf1h7ykxpi4-libdevil-1.7.8.drv'.
error: 1 dependencies of derivation '/nix/store/dlblmv6zp51cnmbx6x77bni88x0frmhd-avisynthplus-3.7.3.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ra1sbhaw4syw4ajrafjfnq898zk46afs-ffmpeg-full-6.1.1.drv' failed to build

Additional context

I pin nixpkgs in the flake user registry, and reference it in my darwin configuration. Previously I had it pinned to 807c549feabce7eddbf259dbdcec9e0600a0660d, and on this same computer, building against that commit still works

❯ nix build github:NixOS/nixpkgs/807c549feabce7eddbf259dbdcec9e0600a0660d#ffmpeg-full
❯ nix run github:NixOS/nixpkgs/807c549feabce7eddbf259dbdcec9e0600a0660d#ffmpeg-full -- -version
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
built with clang version 16.0.6
configuration: --disable-static --prefix=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-full-6.1.1 --target_os=darwin --arch=aarch64 --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/2a5p6k8jy5sv3x4cw8zf460jnakrd96x-ffmpeg-full-6.1.1-data/share/ffmpeg --enable-ffmpeg --enable-ffplay --enable-ffprobe --bindir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-full-6.1.1-bin/bin --enable-avcodec --enable-avdevice --enable-avfilter --enable-avformat --enable-avutil --enable-postproc --enable-swresample --enable-swscale --libdir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-full-6.1.1-lib/lib --incdir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-full-6.1.1-dev/include --enable-doc --enable-htmlpages --enable-manpages --mandir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-full-6.1.1-man/share/man --enable-podpages --enable-txtpages --docdir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ffmpeg-full-6.1.1-doc/share/doc/ffmpeg --disable-alsa --enable-libaom --enable-libaribcaption --enable-libass --enable-libbluray --enable-libbs2b --enable-bzlib --enable-libcaca --enable-libcelt --enable-chromaprint --disable-cuda --enable-cuda-llvm --enable-libdav1d --disable-libdc1394 --disable-libdrm --disable-libfdk-aac --enable-libflite --enable-fontconfig --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libfribidi --enable-libgme --enable-gnutls --enable-libgsm --enable-libharfbuzz --enable-iconv --disable-libjack --enable-ladspa --enable-lzma --disable-libmfx --disable-libmodplug --enable-libmp3lame --enable-libmysofa --disable-cuvid --disable-nvdec --disable-nvenc --enable-openal --enable-opencl --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-opengl --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --disable-libplacebo --disable-libpulse --enable-librav1e --disable-librtmp --disable-libsmbclient --enable-sdl2 --disable-libshaderc --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-librsvg --disable-libsvtav1 --disable-libtensorflow --enable-libtheora --disable-libv4l2 --disable-v4l2-m2m --disable-vaapi --enable-vdpau --enable-libvidstab --disable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --disable-vulkan --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxcb --enable-libxcb-shape --enable-libxcb-shm --enable-libxcb-xfixes --enable-xlib --enable-libxml2 --enable-libxvid --enable-libzimg --enable-zlib --enable-libzmq --disable-debug --enable-optimizations --disable-extra-warnings --disable-stripping --cc=clang --cxx=clang++
libavutil      58. 29.100 / 58. 29.100
libavcodec     60. 31.102 / 60. 31.102
libavformat    60. 16.100 / 60. 16.100
libavdevice    60.  3.100 / 60.  3.100
libavfilter     9. 12.100 /  9. 12.100
libswscale      7.  5.100 /  7.  5.100
libswresample   4. 12.100 /  4. 12.100
libpostproc    57.  3.100 / 57.  3.100

I didn't do a full bisect, but I also can verify that the following pinned commit also works:

Notify maintainers

Maintainers from ffmpeg/generic.nix:

Recent committers not already included:

Metadata

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

~/.config/nix-darwin ☁️
❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.4.0, macOS 14.4.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.18.2`
 - channels(pd): `""`
 - channels(root): `"darwin, nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Add a :+1: reaction to issues you find important.

Atemu commented 6 months ago

Technically not a build failure of ffmpeg but we should get libdevil out of the closure if it's broken.

Atemu commented 6 months ago

The offending package should be a rather easy workaround via -Wno-register but I currently do not have access to a mac.

peterldowns commented 6 months ago

Apologies for mislabeling the report, and thank you for (a) correcting it, (b) the quick response.

The offending package should be a rather easy workaround via -Wno-register but I currently do not have access to a mac.

If you give me a command to run, I can help by running it and telling you if it works!

Atemu commented 6 months ago

Setting env.NIX_CFLAGS_COMPILE="-Wno-register"; in the mkDerivation call of the package should do it.

peterldowns commented 6 months ago

@Atemu sorry, I'm not that experienced with Nix, can you share a snippet of code doing it? Do I need to do it for ffmpeg-full, or just for libdevil? Do I do this in my flake that says to install ffmpeg-full somehow?

If it's easier to just fix it yourself without me, feel free to ignore. Thanks again for the quick response by merging #309423 🙏

peterldowns commented 6 months ago

OK, seems to work with this overlay on pkgs:

      environment.systemPackages = with pkgs.extend(self: super: {
        libdevil = super.libdevil.overrideAttrs (oldAttrs: {
          NIX_CFLAGS_COMPILE = "-Wno-register";
        });
      }); [ 
        # ...
        ffmpeg-full
        # ...
        ];