acowley / ffmpeg-light

Minimal Haskell bindings to the FFmpeg library
BSD 3-Clause "New" or "Revised" License
66 stars 29 forks source link

Build fails with ffmpeg version 5.1 #69

Open FluxusMagna opened 1 year ago

FluxusMagna commented 1 year ago

When building my project with stack I get this:

ffmpeg-light> configure
ffmpeg-light> Configuring ffmpeg-light-0.14.1...
ffmpeg-light> build
ffmpeg-light> Preprocessing library for ffmpeg-light-0.14.1..
ffmpeg-light> In file included from /usr/include/strings.h:23,
ffmpeg-light>                  from /usr/include/string.h:462,
ffmpeg-light>                  from /usr/include/libavutil/common.h:40,
ffmpeg-light>                  from /usr/include/libavutil/avutil.h:296,
ffmpeg-light>                  from /usr/include/libavcodec/codec.h:26,
ffmpeg-light>                  from /usr/include/libavformat/avformat.h:313,
ffmpeg-light>                  from Probe.hsc:34:
ffmpeg-light> Probe.hsc: In function ‘main’:
ffmpeg-light> /home/gusten/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/lib/ghc-8.6.5/template-hsc.h:75:24: error: ‘AVStream’ has no member named ‘codec’
ffmpeg-light>    75 |                 (long) offsetof (t, f));
ffmpeg-light>       |                        ^~~~~~~~
ffmpeg-light> /tmp/stack-9b4872e63d551bb1/ffmpeg-light-0.14.1/Probe.hsc:99:5: note: in expansion of macro ‘hsc_peek’
ffmpeg-light> /tmp/stack-9b4872e63d551bb1/ffmpeg-light-0.14.1/Probe.hsc:106:15: error: unknown type name ‘AVCodecContext’
ffmpeg-light> /tmp/stack-9b4872e63d551bb1/ffmpeg-light-0.14.1/Probe.hsc:106:5: note: in expansion of macro ‘hsc_peek’
ffmpeg-light> /tmp/stack-9b4872e63d551bb1/ffmpeg-light-0.14.1/Probe.hsc:111:15: error: unknown type name ‘AVCodecContext’
ffmpeg-light> /tmp/stack-9b4872e63d551bb1/ffmpeg-light-0.14.1/Probe.hsc:111:5: note: in expansion of macro ‘hsc_peek’
ffmpeg-light> compiling .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/Codec/FFmpeg/Probe_hsc_make.c failed (exit code 1)
ffmpeg-light> command was: /usr/bin/gcc -c .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/Codec/FFmpeg/Probe_hsc_make.c -o .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/Codec/FFmpeg/Probe_hsc_make.o -fno-stack-protector -fno-stack-protector -fuse-ld=gold -D__GLASGOW_HASKELL__=806 -Dlinux_BUILD_OS=1 -Dx86_64_BUILD_ARCH=1 -Dlinux_HOST_OS=1 -Dx86_64_HOST_ARCH=1 -Isrc -I.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/src -I.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/autogen -I.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/global-autogen -include .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/autogen/cabal_macros.h -I/home/gusten/.stack/snapshots/x86_64-linux-tinfo6/33a5db3e2aa99c9b06b88f2640fe1d160993bc00a487d3137c5bcff1f4cdad0e/8.6.5/lib/x86_64-linux-ghc-8.6.5/JuicyPixels-3.3.5-I4RLYE996p5IaEhK0bEaLb/include -I/home/gusten/.stack/snapshots/x86_64-linux-tinfo6/33a5db3e2aa99c9b06b88f2640fe1d160993bc00a487d3137c5bcff1f4cdad0e/8.6.5/lib/x86_64-linux-ghc-8.6.5/vector-0.12.1.2-53ZStWTkIih2KWMAErdIai/include -I/home/gusten/.stack/snapshots/x86_64-linux-tinfo6/be51fdc41698c46cbccfe43fee2c42396b75be8f4d6ed216807ec95c2a9452f4/8.6.5/lib/x86_64-linux-ghc-8.6.5/primitive-0.6.4.0-ILgywxtLpvnAOlEISPpP5b/include -I/home/gusten/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/lib/ghc-8.6.5/bytestring-0.10.8.2/include -I/home/gusten/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/lib/ghc-8.6.5/base-4.12.0.0/include -I/home/gusten/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/lib/ghc-8.6.5/integer-gmp-1.0.2.0/include -I/home/gusten/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/lib/ghc-8.6.5/include -I/home/gusten/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/lib/ghc-8.6.5/include/
Progress 1/2

--  While building package ffmpeg-light-0.14.1 (scroll up to its section to see the error) using:
      /home/gusten/.stack/setup-exe-cache/x86_64-linux-tinfo6/Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.5 --builddir=.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1 build --ghc-options " -fdiagnostics-color=always"
    Process exited with code: ExitFailure 1

The exact package used is the arch linux ffmpeg-2:5.1.2-1.

FluxusMagna commented 1 year ago

I'm unfamiliar with hsc, and the FFmpeg API, but it seems like the struct member codec has changed name or something. I read here that the API had changed significantly for version 4.4.

acowley commented 1 year ago

Thanks for flagging this! I suppose we’ll need to add CPP to support it.