[MPlayer-dev-eng] fix compilation errors with mingw64

Stephen Sheldon sfsheldo at gmail.com
Thu Apr 28 18:06:57 CEST 2011


Diego Biurrun <diego <at> biurrun.de> writes:

> 
> On Tue, Apr 26, 2011 at 09:49:49AM -0700, Stephen Sheldon wrote:
> > I use mingw64 to compile mplayer in Windows 7 64-bits.  I use the  
> > mingw64-x86_64 packages on cygwin.  After the recent change to configure  
> > to add the flag "-Werror-implicit-funtion-declaration" I got 3  
> > compilation errors.  Attached is a patch to fix them.
> 
> Show us the errors please.
> 
> > --- configure	(revision 33331)
> > +++ configure	(working copy)
> > @@ -3885,6 +3885,9 @@
> >  echocheck "swab()"
> >  _swab=no
> >  define_statement_check "_XOPEN_SOURCE 600" "unistd.h" 'int a, b; swab(&a,
&b, 0)' && _swab=yes
> > +if test "$_swab" != yes ; then
> > +    define_statement_check "A A" "stdlib.h" 'int a, b; swab(&a, &b, 0)' &&
_swab=yes
> 
> Are you just trying to check for swab without _XOPEN_SOURCE defined?
> Then you should use plain statement_check.  And where is swab() in
> MinGW64?  unistd.h is the right place, if it is in stdlib.h, you
> should be patching MinGW64, not MPlayer.
> 
> > --- command.c	(revision 33331)
> > +++ command.c	(working copy)
> > @@ -69,6 +69,7 @@
> >  #include "libavutil/avstring.h"
> >  #include "edl.h"
> > +#include "osdep/strsep.h"
> 
> This one is correct, applied along with another missing instance.
> 
> Diego
> 


Here is the error for libao2/ao_pcm.c.  The missing definition of _get_osfhandle
is in io.h.

x86_64-w64-mingw32-gcc -MD -MP -Wundef -Wall -Wno-switch -Wno-parentheses
-Wpointer-arith -Wredundant-decls -Werror-implicit-function-declaration
-Wstrict-prototypes -Wmissing-prototypes -Wdisabled-optimization
-Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99  -O4 -march=native
-mtune=native -pipe -ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -Ilibdvdread4 -I. -Iffmpeg
-I/mingw64/include -fno-common -DPIC -I/mingw64/include/freetype2
-I/mingw64/include -I/mingw64/include   -DFF_API_MAX_STREAMS=0 -c -o
libao2/ao_pcm.o libao2/ao_pcm.c
libao2/ao_pcm.c: In function 'uninit':
libao2/ao_pcm.c:208:9: error: implicit declaration of function '_get_osfhandle'
libao2/ao_pcm.c:208:35: warning: cast to pointer from integer of different size
make: *** [libao2/ao_pcm.o] Error 1


In mingw64 the definition of swab is in stdlib.c, apparently following the
practice of MSVC.  The article for "swab (Programming)" in Wikipedia mentions
stdlib.h as a possible alternative location for the function, as well as
string.h, which is where it is in MinGW32.  Now I see I should have used plain
statement_check.



More information about the MPlayer-dev-eng mailing list