[FFmpeg-devel] ffmpeg and musl toolchain support

wm4 nfxjfg at googlemail.com
Mon Sep 1 16:59:58 CEST 2014


On Mon, 01 Sep 2014 16:14:52 +0200
Jörg Krause <jkrause at posteo.de> wrote:

> When building against musl instead of glibc, compilation fails at
> libavutil/error.c
> 
> CC libavutil/error.o
> libavutil/error.c: In function 'av_strerror':
> libavutil/error.c:68:9: error: implicit declaration of function
> 'strerror_r' [-Werror=implicit-function-declaration]
> cc1: some warnings being treated as errors
> make: *** [libavutil/error.o] Error 1
> 
> I tried to find a fix and I am very unsure about the solution.
> 
> I am cross compiling for a linux target. I took a look at 
> ffmpeg/configure and added the following line:
> 
> # OS specific
> case $target_os in
> [..]
> linux)
>          add_cppflags -D_POSIX_SOURCE
>          enable dv1394
>          ;;
> [..]
> 
> With this I can compile ffmpeg successfully.
> 
> What do you think about this solution?
> 
> Why is #undef _GNU_SOURCE in libavutil/error.c defined?

Because there are two strerror_r variants: standard and GNU. They have
different semantics (but same signature). I guess this undef is supposed
to select the POSIX one?

In general, I suspect it might be best to never define _GNU_SOURCE, but
_POSIX_C_SOURCE instead.

Instead of breaking everything, maybe this would be best to put into
error.c:

#undef _GNU_SOURCE
#define _POSIX_C_SOURCE 200809L


More information about the ffmpeg-devel mailing list