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

Rich Felker dalias at aerifal.cx
Tue Mar 20 04:57:10 CET 2007


On Mon, Mar 19, 2007 at 10:53:06AM +0100, Diego Biurrun wrote:
> 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

This is definitely bad since it could prevent headers from working
properly in other places...

> 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.

While I don't object (I prefer solution 1 but 1+2 is ok), it's wrong
for unistd.h to define open at all. Only fcntl.h should define open.
We should send bug reports upstream.

Rich



More information about the MPlayer-dev-eng mailing list