[FFmpeg-devel] [PATCH v2 1/4] libavutil/error: fix build with musl toolchain

Jörg Krause jkrause at posteo.de
Thu Sep 4 23:27:49 CEST 2014

On 09/04/2014 05:27 PM, Hendrik Leppkes wrote:
> On Wed, Sep 3, 2014 at 11:53 AM, Jörg Krause <jkrause at posteo.de> wrote:
>> Add the feature test macro which is required for building with the
>> musl toolchain.
>> The feature test macro _XOPEN_SOURCE = 600 provides the XSI-compliant
>> version of strerror_r().
>> [..]
>   _XOPEN_SOURCE 600 is set as a compiler parameter for all other
> toolchains that need it, including glibc and whatnot.
> We should really do the same for musl here, using special treatment is weird.
> Detect musl in configure, add a new libc block, set
> -D_XOPEN_SOURCE=600 in the cflags, and it would be consistent with
> everything else.

We had a discussion about this issue here at the mailing list.

Detecting musl in configure is not possible. There is no __MUSL__ like 
__GLIBC__ in <features.h>. The maintainers of musl prefer that the 
library is tested for the exposed feature set.

Another approach is to set the desired feature test macro at source 
level, which is the recommation of the GNU C Library Reference Manual, 
instead of setting it with -D.

If we follow this approach, we have constintency for glibc, uclibc, and 
musl. And we do not need a libc block for them in configure (at least 
not for setting any feature test macro with -D).

More information about the ffmpeg-devel mailing list