Skip to contentSkip to conversation

Fix MSVC build on cygwin

PATCH In review Ramsay Jones 4 participants 5 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix MSVC build on cygwin

In the MSVC section of the Makefile, BASIC_CFLAGS is set to a value which contains the string "-DWIN32-D_CONSOLE". This results in a (single) malformed -Define being passed to the compiler. At least on my cygwin installation, the msvc compiler seems to ignore this parameter, without issuing an error or warning, and results in the WIN32 and _CONSOLE macros being undefined. This breaks the build.

In order to fix the build, we simply insert a space between the two -Define parameters, "-DWIN32" and "-D_CONSOLE", as originally intended.

---

Hi *,

The original version of this patch used line-continuation to wrap the over-long lines in the MSVC section. (the lines that set up BASIC_CFLAGS, COMPAT_CFLAGS and BASIC_LDFLAGS.) However, that somewhat obscured the important change in this patch (and some people don't find line-continuation easier to read anyway ;-).

ATB,
Ramsay Jones

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index 12defd4..ae9bb03 100644
@@ -914,7 +914,7 @@ ifdef MSVC
 	CC = compat/vcbuild/scripts/clink.pl
 	AR = compat/vcbuild/scripts/lib.pl
 	CFLAGS =
-	BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32-D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
+	BASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32 -D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE
 	COMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o
 	COMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -DSTRIP_EXTENSION=\".exe\"
 	BASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib
Signature · 1 line
1.6.4
#1 lore raw
Quoted 8 lines · Ramsay Jones

In the MSVC section of the Makefile, BASIC_CFLAGS is set to a value which contains the string "-DWIN32-D_CONSOLE". This results in a (single) malformed -Define being passed to the compiler. At least on my cygwin installation, the msvc compiler seems to ignore this parameter, without issuing an error or warning, and results in the WIN32 and _CONSOLE macros being undefined. This breaks the build.

Quoted 5 lines

In order to fix the build, we simply insert a space between the two -Define parameters, "-DWIN32" and "-D_CONSOLE", as originally intended.

Thanks; that's quite a detailed description to explain why -DFOO-DBAR is bad when -DFOO -DBAR was wanted ;-)

#2 lore raw
Quoted 2 lines · Junio C Hamano

Thanks; that's quite a detailed description to explain why -DFOO-DBAR is bad when -DFOO -DBAR was wanted ;-)

Heh, yeah I usually have the opposite problem; often I can't spare any words past the one-line summary...

I suspect the unusual verbosity won't last... ;-)

ATB,
Ramsay Jones

#4 lore raw

Heya,

Quoted 2 lines · Johannes Schindelin

I thought we only used shell patterns for filenames, and regexes for everything else?

Maybe he's enacting a long silence after his Hi? "Hi "?

Signature · 3 lines
Cheers,

Sverre Rabbelier