savonet / ocaml-ffmpeg

OCaml bindings to the FFmpeg library.
http://www.liquidsoap.info/ocaml-ffmpeg/
GNU Lesser General Public License v2.1
48 stars 12 forks source link

Compilation FAILS on all platforms #62

Open Yahav opened 1 month ago

Yahav commented 1 month ago

@toots So, the following issue: https://github.com/savonet/ocaml-ffmpeg/issues/60 Its not related to Apple Silicon, same build error happens on any other platform, making ocaml ffmpeg unusable - this should be considered a breaking issue.

[ERROR] The compilation of ffmpeg-avutil.1.1.11 failed at "dune build -p ffmpeg-avutil -j 23 @install".

#=== ERROR while compiling ffmpeg-avutil.1.1.11 ===============================#
# context     2.2.0 | linux/x86_64 | ocaml.4.14.2 | https://opam.ocaml.org#471f15306c0f2b1845912395b8ae9b978d3d05ac
# path        ~/.opam/default/.opam-switch/build/ffmpeg-avutil.1.1.11
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p ffmpeg-avutil -j 23 @install
# exit-code   1
# env-file    ~/.opam/log/ffmpeg-avutil-150488-4bae05.env
# output-file ~/.opam/log/ffmpeg-avutil-150488-4bae05.out
### output ###
# avutil_stubs.c:1207:11: warning: implicit declaration of function ‘av_opt_get_channel_layout’; did you mean ‘av_opt_get_chlayout’? [-Wimplicit-function-declaration]
# [...]
#       |           av_opt_get_chlayout
# avutil_stubs.c: In function ‘ocaml_avutil_av_opt_iter’:
# avutil_stubs.c:1322:8: error: ‘AV_OPT_TYPE_CHANNEL_LAYOUT’ undeclared (first use in this function); did you mean ‘AV_OPT_TYPE_CHLAYOUT’?
#  1322 |   case AV_OPT_TYPE_CHANNEL_LAYOUT:
#       |        ^~~~~~~~~~~~~~~~~~~~~~~~~~
#       |        AV_OPT_TYPE_CHLAYOUT
# avutil_stubs.c:1322:8: note: each undeclared identifier is reported only once for each function it appears in
# avutil_stubs.c:1324:9: warning: implicit declaration of function ‘av_get_channel_name’; did you mean ‘av_channel_name’? [-Wimplicit-function-declaration]
#  1324 |     if (av_get_channel_name(option->default_val.i64)) {
#       |         ^~~~~~~~~~~~~~~~~~~
#       |         av_channel_name

I do believe the following commit already addressed it https://github.com/savonet/ocaml-ffmpeg/commit/5406339cbf9f6def31acd9333f223873e266dd0a However, until you publish a release it won't be available through ocaml.

Looking forward for a release.

toots commented 1 month ago

Hi @Yahav. Yes, ffmpeg is moving forward with their new channel API and has removed backward compatibility with the 7 release cycle.

The release is from April of 2024 so fairly recent. Most distributions still ship ffmpeg 6 which has the backward compatibility layer. The latest debian stable, bookworm, still has version 5 without the new channel API.

From our perspective, we can only support one or the other. The latest release is using the old channel API and is currently compatible with most distributions.

In the latest main branch, we have switched to the new channel API and are using it in our liquidsoap build for the next release. For debianbookworm, we are using the deb-multimedia package packports.

As far as I know, homebrew is the only package manager shipping ffmpeg 7 by default at the moment. With it, you can do the following:

% brew unlink ffmpeg
% brew install ffmpeg@6
% brew link ffmpeg@6

This will let you install the latest released ocaml-ffmpeg.

Otherwise, you can also point opam to the latest code:

% git clone https://github.com/savonet/ocaml-ffmpeg.git
% cd ocaml-ffmpeg
% opam install -y .