git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix MSVC build on cygwin

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Oct 8, 2009, 15:21 UTC
Message-ID
<4ACE0388.6070706@ramsay1.demon.co.uk>

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.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
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(-)
diff --git a/Makefile b/Makefile
index 12defd4..ae9bb03 100644
--- a/Makefile
+++ b/Makefile
@@ -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
-- 
1.6.4
Next: Johannes Schindelin
Message 1 of 5 in “Fix MSVC build on cygwin”
  1. Fix MSVC build on cygwinRamsay Jones, Oct 8, 2009
  2. Johannes SchindelinOct 8, 2009
  3. Sverre RabbelierOct 8, 2009
  4. Junio C HamanoOct 9, 2009
  5. Ramsay JonesOct 9, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.