[FFmpeg-devel] os_support.c r24072: change of include order

Axel Holzinger aholzinger
Sat Jul 31 13:01:37 CEST 2010

On Fri, 23 Jul 2010, 9:52 PM, M?ns Rullg?rd wrote:
> Martin Storsj? <martin at martin.st> writes:
> > On Fri, 23 Jul 2010, Axel Holzinger wrote:
> >
> >> Hello M?ns et al,
> >> 
> >> os_support.c r24072 (os_support: include some headers only when
> >> needed) changed the include order. In r22329 unistd.h, fcntl.h
> >> sys/time.h were included BEFORE inclusion of os_support.h, 
> in r24072 
> >> they are included AFTER inclusion of os_suport.h (besides making 
> >> inclusion conditional on CONFIG_NETWORK).
> >> 
> >> This breaks (at least my) build on Windows, because there is an 
> >> ambiguity with the close function in winsock2.h (there is another

> >> close function in io.h).
> >> 
> >> On my build the issue is solved, if os_support.h is included
> >> the #include "network.h" line (potentially also directly 
> before this 
> >> line).
> >> 
> >> Would it be thinkable to again change os_support.c and include 
> >> os_support.h again after the above mentioned headers (similar to 
> >> r22329)?
> >
> > This would be ok for me at least (didn't test it yet, though).
> I'll look into it.

Problem solved, no further action needed. Thank you and sorry for the

If interested in the reason of the issue, please read on. But be aware
this is Microsoft specific ;-)

As already mentioned I'm currently trying to use icl to build FFmpeg
on Windows.

This code in os_support.h

/* most of the time closing a socket is just closing an fd */
#define closesocket close

was defining "closesocket" to be "close", because HAVE_CLOSESOCKET was
defined to zero in config.h. This was wrong, because closesocket was
there. So I figured out in the configure script that
"check_func_headers winsock2.h closesocket" in configure wants to link
to libws2.lib (-lws2), but as icl uses the MS libs, libws2.lib was not
there (but wsock32.lib) and so "check_func_headers winsock2.h
closesocket" failed, because the linker did error out with not finding

For the time being I copied wsock32.lib to libws2.lib.

If there will ever be a nice and elegant way of using icl for building
FFmpeg on Windows, the check for wsock32.lib instead of libws2.lib has
to be done in the configure script. But this is future music.


More information about the ffmpeg-devel mailing list