On 09/01/2014 04:59 PM, wm4 wrote:
On Mon, 01 Sep 2014 16:14:52 +0200
Jörg Krause <jkra...@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

I see! I found this on the linux man page (http://linux.die.net/man/3/strerror_r) for strerror_r:

The XSI-compliant version of *strerror_r*() is provided if:
(_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
Otherwise, the GNU-specific version is provided.

And here (http://man7.org/linux/man-pages/man7/feature_test_macros.7.html) I found this:
*_POSIX_C_SOURCE *is defined, according to the value of *_XOPEN_SOURCE*:

   600 <= *_XOPEN_SOURCE *< 700: *_POSIX_C_SOURCE *is defined with the
   value 200112L.

So I will propose a patch with:

#undef _GNU_SOURCE
#define _XOPEN_SOURCE 600

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to