[MPlayer-dev-eng] MinGW hack in libaf/Makefile

Diego Biurrun diego at biurrun.de
Mon Mar 19 10:53:06 CET 2007


On Sun, Mar 18, 2007 at 11:50:42PM +0100, Diego Biurrun wrote:
> In libaf/Makefile we have
> 
>   ifeq ($(TARGET_OS),MINGW32)
>   CFLAGS += -D_IO_H_
>   endif
> 
> which was added by Sascha Sommer a loooong time ago:
> 
> ------------------------------------------------------------------------
> r9771 | faust3 | 2003-03-31 18:55:53 +0200 (Mon, 31 Mar 2003) | 2 lines
> 
> workaround conflict with the MINGW32 open function
> ------------------------------------------------------------------------
> 
> Is it still a problem?  Can somebody test compilation with those lines
> removed?  I don't have access to a MinGW box.  I would like to remove
> this hack and fix the problem properly if necessary.

Compn/Benjamin made a test compile on MinGW for me, here is the result:

gcc -Wall -I../libavutil -I../libavcodec -I. -I.. 
-Wdeclaration-after-statement -O4 -march=i486 -mtune=i686 -pipe 
-ffast-math -fomit-frame-pointer -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE 
-I/usr/local/include/freetype2 -I/usr/local/include   -c -o 
af_channels.o af_channels.c
af_channels.c:271: error: conflicting types for 'open'
d:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/io.h:280:
error: previous declaration of 'open' was here
af_channels.c:271: error: conflicting types for 'open'
d:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/io.h:280:
error: previous declaration of 'open' was here
make: *** [af_channels.o] Error 1

It appears that on MinGW unistd.h includes io.h, which has a conflicting
declaration for open.  There are essentially two ways to fix this:

1) Remove the #include <unistd.h>, it does not appear to be needed, at
   least on Linux.
2) Rename open to af_open.

Probably doing both is the right solution.  Only one file (af_export.c)
appears to need unistd.h and there open has already been renamed to
af_open.

So unless there are any objections I'll go ahead and do that.

Diego



More information about the MPlayer-dev-eng mailing list