[FFmpeg-devel] FATE failure on mingw gcc-4.2.4

Måns Rullgård mans
Tue Mar 9 13:17:37 CET 2010


Ramiro Polla <ramiro.polla at gmail.com> writes:

> 2010/3/9 M?ns Rullg?rd <mans at mansr.com>:
>> The build failures on mingw with gcc 4.2.4 are caused by the recent
>> addition of -Werror=missing-prototypes triggering an error in
>> stdio.h. ?For some reason, this gcc version isn't treating this as a
>> system header and suppressing warnings.
>>
>> It might be possible to work around this by providing an explicit
>> --sysroot argument to ffmpeg's configure. ?Could someone with an
>> affected system please try this?
>
> --sysroot made no difference. I had to rebuild binutils for FFmpeg's
> configure to accept sysroot, should I rebuild gcc with some other
> option too?

IIRC, gcc configure takes a --with-sysroot flag or similar.

> from _mingw.h:	
> # if __GNUC_STDC_INLINE__
> #  define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
> # else
> #  define __CRT_INLINE extern __inline__
> # endif
>
> from stdio.h:
> #if !defined _MT
>
> __CRT_INLINE int __cdecl __MINGW_NOTHROW getc (FILE* __F)
>
> [...]
>
> #else  /* Use library functions.  */
>
> _CRTIMP int __cdecl __MINGW_NOTHROW     getc (FILE*);
> _CRTIMP int __cdecl __MINGW_NOTHROW     putc (int, FILE*);
> _CRTIMP int __cdecl __MINGW_NOTHROW     getchar (void);
> _CRTIMP int __cdecl __MINGW_NOTHROW     putchar (int);
>
> #endif
>
> in 4.2.2 that becomes (text vertically aligned):
> extern __inline__                             int
> __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) getc (FILE* __F)

Right, now I remember the C99-compatible inline semantics are only
available in gcc 4.3 and later.  The earlier ones do something else,
and do not define that macro.

What this means is that the mingw headers do not work _at all_ with
gcc 4.2.  Try compiling two object files, both calling getc(), and
link them together.  Unless I am mistaken, you'll get a multiple
definition error.  You should report this as a bug to the mingw devs.
In a nutshell, the inline functions as written can only be used with
gcc if __GNUC_STDC_INLINE__ is defined.  Some more macro trickery
would make it work with static inlines instead.

> in 4.4.2 that becomes:
> extern inline __attribute__((__gnu_inline__)) int
> __attribute__((__cdecl__)) __attribute__ ((__nothrow__)) getc (FILE* __F)
>
> if I define _MT it works (I have no idea what that is, but I'd guess
> thread-safe something).

Yes, it's thread-safe something.  It is automatically defined if you
pass -mthreads to gcc (see, there's one of those non-standard thread
options).

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list