Sven Strickroth wrote:
> Am 31.01.2013 19:28 schrieb Ramsay Jones:
>> Commit 0f77dea9 ("mingw: move poll out of sys-folder", 24-10-2011), along
>> with other commits in the 'ef/mingw-upload-archive' branch (see commit
>> 7406aa20), effectively reintroduced the same problem addressed by commit
>> 56fb3ddc ("msvc: Fix compilation errors in compat/win32/sys/poll.c",
>> 04-12-2010).
>> In order to fix the compilation errors, we use the same solution adopted
>> in that earlier commit. In particular, we set _WIN32_WINNT to 0x0502
>> (which would target Windows Server 2003) prior to including the winsock2.h
>> header file.
> This change causes problems compiling with MSVC2012 for me. If I don't
> define NO_SYS_POLL_H git-compat-util.h now tries to include <sys/poll.h>
> which does not exist for MSVC and if I define NO_SYS_POLL_H
> git-compat-util.h now tries to include <poll.h> which also doesn't exist
> for MSVC.
> Including compat/poll into the includes path causes redefinition errors.
> How have you tested this?

I used the Makefile, with the Visual C++ 2008 command line compiler on
Windows XP (SP3), to build a vanilla git on MinGW.

    ramsay (pu) ms $ git checkout master
    Switched to branch 'master'
    ramsay (master) ms $ git rev-parse master
    ramsay (master) ms $ make clean >/dev/null 2>&1
    ramsay (master) ms $ make >ms-out1 2>&1
    ramsay (master) ms $ grep error ms-out1
    ramsay (master) ms $ ./git version
    git version 1.8.3.rc1.25.g423ecb0.MSVC
    ramsay (master) ms $


    ramsay (tmp) ms $ rm git.o
    ramsay (tmp) ms $ make V=1 git.o
    compat/vcbuild/scripts/ -o git.o -c    -nologo -I. -I../zlib 
    build -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H 
    S  -DUNRELIABLE_FSTAT -DSHA1_HEADER='"block-sha1/sha1.h"' 
    DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/regex 
-Icompat/win32 -D
    at/poll -DNO_STRCASESTR -DNO_STRLCPY -DNO_STRTOUMAX -Icompat/fnmatch 
    PATH='"/bin/sh"' -DDEFAULT_HELP_FORMAT='"html"' 
    doc"' '-DGIT_MAN_PATH="share/man"' '-DGIT_INFO_PATH="share/info"' git.c
    git.c(204) : warning C4090: 'function' : different 'const' qualifiers
    git.c(218) : warning C4090: 'function' : different 'const' qualifiers
    git.c(221) : warning C4090: 'function' : different 'const' qualifiers
    ramsay (tmp) ms $

Note that '-Icompat/poll' is passed on the command-line (it is split at -Icomp
above), which comes from:

    ramsay (tmp) ms $ git grep -n 'compat/poll'
    Makefile:647:LIB_H += compat/poll/poll.h
    Makefile:1235:  COMPAT_CFLAGS += -DNO_POLL -Icompat/poll
    Makefile:1236:  COMPAT_OBJS += compat/poll/poll.o
    ramsay (tmp) ms $

I have a patch which allows me to generate the preprocessed output file
and, after running it on git.c (=> git.i), I can see that msvc reads the
compat/poll/poll.h file. (from line 128 of git-compat-util.h).

Are you using a MSVC "project" file? If so, is it equivalent to the Makefile?
Has the "#include" behaviour changed between MSVC 2008 -> MSVC 2012?

Ramsay Jones

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to