[FFmpeg-trac] #11156(avdevice:new): libavdevice fails to compile on Linux (musl libc)
FFmpeg
trac at avcodec.org
Mon Aug 26 06:49:58 EEST 2024
#11156: libavdevice fails to compile on Linux (musl libc)
----------------------------------+--------------------------------------
Reporter: 2246c68 | Type: defect
Status: new | Priority: normal
Component: avdevice | Version: git-master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+--------------------------------------
Summary of the bug:
libavdevice fails to build on Linux (musl libc).
How to reproduce:
{{{
% ../configure \
--cross-prefix="aarch64-unknown-linux-musl-" \
--target-os="linux" \
--arch="aarch64" \
--disable-alsa \
--disable-appkit \
--disable-asm \
--disable-audiotoolbox \
--disable-avfoundation \
--disable-bzlib \
--disable-coreimage \
--disable-debug \
--disable-doc \
--disable-iconv \
--disable-libxcb \
--disable-lzma \
--disable-neon \
--disable-schannel \
--disable-sdl2 \
--disable-securetransport \
--disable-static \
--disable-symver \
--disable-videotoolbox \
--disable-vulkan \
--disable-xlib \
--disable-zlib \
--disable-manpages \
--disable-htmlpages \
--disable-podpages \
--disable-txtpages \
--enable-pic \
--enable-shared \
--enable-small \
--enable-version3
% make
src/libavdevice/v4l2.c: In function 'device_open':
src/libavdevice/v4l2.c:137:17: error: assignment to 'int (*)(int, long
unsigned int, ...)' from incompatible pointer type 'int (*)(int, int,
...)' [-Wincompatible-pointer-types]
137 | s->ioctl_f = prefix ## ioctl; \
| ^
src/libavdevice/v4l2.c:151:9: note: in expansion of macro 'SET_WRAPPERS'
151 | SET_WRAPPERS();
| ^~~~~~~~~~~~
}}}
git bisect points to 9e674b31606c805dd31b4bb754364a72a5877238 as the
culprit.
There is one main issue with the changes implemented in that commit,
specifically the use of the `__musl__` macro to write musl-specific code:
{{{
...
#if defined(__sun) || defined(__BIONIC__) || defined(__musl__) /* POSIX-
like */
...
}}}
It should be noted that musl does not currently provide any way to detect
itself (see https://wiki.musl-libc.org/faq). That is, neither the
`__musl__` nor `__MUSL__` macros exists. The `#if defined(__musl__)`
condition will always evaluate to false, even on musl platforms, leading
FFmpeg to use the wrong prototype.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11156>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list