Skip to content

Commit 73f4439

Browse files
committed
patch 8.0.1178: using old compiler on MS-Windows
Problem: Using old compiler on MS-Windows. Solution: Switch default build on MS-Windows to use MSVC 2015. (Ken Takata)
1 parent 54e5dbf commit 73f4439

File tree

7 files changed

+105
-24
lines changed

7 files changed

+105
-24
lines changed

src/GvimExt/Makefile

+7-4
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ olelibsdll = ole32.lib uuid.lib oleaut32.lib user32.lib gdi32.lib advapi32.lib
5151
# include CPUARG
5252
cflags = $(cflags) $(CPUARG)
5353

54+
SUBSYSTEM = console
55+
!if "$(SUBSYSTEM_VER)" != ""
56+
SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER)
57+
!endif
58+
5459
all: gvimext.dll
5560

5661
gvimext.dll: gvimext.obj \
5762
gvimext.res
58-
# $(implib) /NOLOGO -machine:$(CPU) -def:gvimext.def $** -out:gvimext.lib
59-
# $(link) $(dlllflags) -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib gvimext.lib comctl32.lib gvimext.exp
60-
$(link) $(lflags) -dll -def:gvimext.def -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib comctl32.lib
61-
if exist $*.dll.manifest mt -nologo -manifest $*.dll.manifest -outputresource:$*.dll;2
63+
$(link) $(lflags) -dll -def:gvimext.def -base:0x1C000000 -out:$*.dll $** $(olelibsdll) shell32.lib comctl32.lib -subsystem:$(SUBSYSTEM)
64+
if exist $*.dll.manifest mt -nologo -manifest $*.dll.manifest -outputresource:$*.dll;2
6265

6366
gvimext.obj: gvimext.h
6467

src/INSTALLpc.txt

+36-10
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,20 @@ The currently preferred method is using the free Visual C++ Toolkit 2008
4343
1. Microsoft Visual C++
4444
=======================
4545

46+
We do not provide download links, since Microsoft keeps changing them. You
47+
can search for "Visual C++ 2015 build tools", for example. You will need to
48+
create a Microsoft account (it's free).
49+
50+
4651
Visual Studio
4752
-------------
4853

4954
Building with Visual Studio (VS 98, VS .NET, VS .NET 2003, VS 2005, VS 2008,
5055
VS2010, VS2012, VS2013 and VS2015) is straightforward. (These instructions
5156
should also work for VS 4 and VS 5.)
5257

53-
Using VS C++ 2008 Express is recommended, the binaries built with that run on
54-
nearly all platforms. Binaries from later versions may not run on Windows 95
55-
or XP.
58+
Using VS C++ 2008 Express is recommended if you need the binary to run on
59+
Windows 95 or 97, see |msvc-2008-express| below.
5660

5761
To build Vim from the command line with MSVC, use Make_mvc.mak.
5862
Visual Studio installed a batch file called vcvars32.bat, which you must
@@ -117,8 +121,8 @@ To set the environment execute the msvc2010.bat script. You can then build
117121
Vim with Make_mvc.mak.
118122

119123

120-
Targeting Windows XP with new MSVC *new-msvc-windows-xp*
121-
----------------------------------
124+
Targeting Windows XP with MSVC 2012 and later *new-msvc-windows-xp*
125+
---------------------------------------------
122126

123127
Beginning with Visual C++ 2012, Microsoft changed the behavior of LINK.EXE
124128
so that it targets Windows 6.0 (Vista) by default. In order to override
@@ -127,16 +131,28 @@ follows:
127131
LINK ... /subsystem:console,5.01
128132

129133
Make_mvc.mak now supports a macro SUBSYSTEM_VER to pass the Windows version.
130-
Use lines like follows to target Windows XP (assuming using Visual C++ 2012
131-
under 64-bit Windows):
134+
Use lines like follows to target Windows XP x86 (assuming using Visual C++
135+
2012 under 64-bit Windows):
132136
set WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A
133-
set SDK_INCLUDE_DIR=%WinSdk71%\Include
134137
set INCLUDE=%WinSdk71%\Include;%INCLUDE%
135138
set LIB=%WinSdk71%\Lib;%LIB%
136-
set PATH=%WinSdk71%\Bin;%PATH%
137139
set CL=/D_USING_V110_SDK71_
138140
nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.01
139141

142+
To target Windows XP x64 instead of x86, you need to change the settings of
143+
LIB and SUBSYSTEM_VER:
144+
...
145+
set LIB=%WinSdk71%\Lib\x64;%LIB%
146+
...
147+
nmake -f Make_mvc.mak ... WINVER=0x0501 SUBSYSTEM_VER=5.02
148+
149+
If you use Visual C++ 2015 (either Express or Community Edition), executing
150+
msvc2015.bat will set them automatically. For x86 builds run this without
151+
options:
152+
msvc2015
153+
For x64 builds run this with the "x86_amd64" option:
154+
msvc2015 x86_amd64
155+
140156
The following Visual C++ team blog can serve as a reference page:
141157
http://blogs.msdn.com/b/vcblog/archive/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-2012.aspx
142158

@@ -482,14 +498,24 @@ You need to set the following variables:
482498
E.g. C:\Program Files (x86)\Racket
483499
DYNAMIC_MZSCHEME: Whether dynamic linking is used. Usually, set to yes.
484500
MZSCHEME_VER: Racket DLL version which is used for the file name.
485-
E.g. 3m_9z0ds0 for Racket 6.3.
501+
See below for a list of MZSCHEME_VER.
486502
The DLL can be found under the lib directory. E.g.
487503
C:\Program Files (x86)\Racket\lib\libracket3m_XXXXXX.dll
488504
MZSCHEME_COLLECTS: (Optional) Path of the collects directory used at
489505
runtime. Default: $(MZSCHEME)\collects
490506
User can override this with the PLTCOLLECTS environment
491507
variable.
492508

509+
List of MZSCHEME_VER (incomplete):
510+
511+
Racket ver. | MZSCHEME_VER
512+
==========================
513+
6.3 | 3m_9z0ds0
514+
6.6 | 3m_a0solc
515+
6.8 | 3m_a1zjsw
516+
6.10 | 3m_a36fs8
517+
518+
493519
E.g. When using MSVC (as one line):
494520

495521
nmake -f Make_mvc.mak

src/Make_mvc.mak

+13-6
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ CPUARG = /arch:AVX2
587587
! endif
588588
!endif
589589

590-
# Pass CPUARG to GVimExt, to avoid using version-dependent defaults
590+
# Pass CPUARG to GvimExt, to avoid using version-dependent defaults
591591
MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) CPUARG="$(CPUARG)"
592592

593593

@@ -789,9 +789,14 @@ SUBSYSTEM = console
789789
CUI_INCL = iscygpty.h
790790
CUI_OBJ = $(OUTDIR)\iscygpty.obj
791791
!endif
792+
SUBSYSTEM_TOOLS = console
792793

793794
!if "$(SUBSYSTEM_VER)" != ""
794795
SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER)
796+
SUBSYSTEM_TOOLS = $(SUBSYSTEM_TOOLS),$(SUBSYSTEM_VER)
797+
# Pass SUBSYSTEM_VER to GvimExt and other tools
798+
MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) SUBSYSTEM_VER=$(SUBSYSTEM_VER)
799+
MAKEFLAGS_TOOLS = $(MAKEFLAGS_TOOLS) SUBSYSTEM_VER=$(SUBSYSTEM_VER)
795800
!endif
796801

797802
!if "$(GUI)" == "yes" && "$(DIRECTX)" == "yes"
@@ -1186,24 +1191,26 @@ $(OUTDIR):
11861191

11871192
install.exe: dosinst.c
11881193
$(CC) /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib \
1189-
user32.lib ole32.lib advapi32.lib uuid.lib
1194+
user32.lib ole32.lib advapi32.lib uuid.lib \
1195+
-link -subsystem:$(SUBSYSTEM_TOOLS)
11901196
- if exist install.exe del install.exe
11911197
ren dosinst.exe install.exe
11921198

11931199
uninstal.exe: uninstal.c
1194-
$(CC) /nologo -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib
1200+
$(CC) /nologo -DNDEBUG -DWIN32 uninstal.c shell32.lib advapi32.lib \
1201+
-link -subsystem:$(SUBSYSTEM_TOOLS)
11951202

11961203
vimrun.exe: vimrun.c
1197-
$(CC) /nologo -DNDEBUG vimrun.c
1204+
$(CC) /nologo -DNDEBUG vimrun.c -link -subsystem:$(SUBSYSTEM_TOOLS)
11981205

11991206
xxd/xxd.exe: xxd/xxd.c
12001207
cd xxd
1201-
$(MAKE) /NOLOGO -f Make_mvc.mak
1208+
$(MAKE) /NOLOGO -f Make_mvc.mak $(MAKEFLAGS_TOOLS)
12021209
cd ..
12031210

12041211
tee/tee.exe: tee/tee.c
12051212
cd tee
1206-
$(MAKE) /NOLOGO -f Make_mvc.mak
1213+
$(MAKE) /NOLOGO -f Make_mvc.mak $(MAKEFLAGS_TOOLS)
12071214
cd ..
12081215

12091216
GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h

src/msvc2015.bat

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@echo off
2+
rem To be used on MS-Windows for Visual C++ 2015 (either Express or Community)
3+
rem See INSTALLpc.txt for information.
4+
rem
5+
rem Usage:
6+
rem For x86 builds run this without options:
7+
rem msvc2015
8+
rem For x64 builds run this with "x86_amd64" option:
9+
rem msvc2015 x86_amd64
10+
@echo on
11+
12+
call "%VS140COMNTOOLS%..\..\VC\vcvarsall.bat" %*
13+
14+
rem Use Windows SDK 7.1A for targeting Windows XP.
15+
if "%ProgramFiles(x86)%"=="" (
16+
set "WinSdk71=%ProgramFiles%\Microsoft SDKs\Windows\v7.1A"
17+
) else (
18+
set "WinSdk71=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A"
19+
)
20+
if not exist "%WinSdk71%" (
21+
echo Windows SDK 7.1A is not found. Targeting Windows Vista and later.
22+
goto :eof
23+
)
24+
25+
set INCLUDE=%WinSdk71%\Include;%INCLUDE%
26+
if "%Platform%"=="x64" (
27+
set "LIB=%WinSdk71%\Lib\x64;%LIB%"
28+
set SUBSYSTEM_VER=5.02
29+
) else (
30+
set "LIB=%WinSdk71%\Lib;%LIB%"
31+
set SUBSYSTEM_VER=5.01
32+
)
33+
set CL=/D_USING_V110_SDK71_

src/tee/Make_mvc.mak

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# A very (if not the most) simplistic Makefile for MSVC
22

3+
SUBSYSTEM = console
4+
!if "$(SUBSYSTEM_VER)" != ""
5+
SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER)
6+
!endif
7+
38
CC=cl
49
CFLAGS=/O2 /nologo
510

611
tee.exe: tee.obj
7-
$(CC) $(CFLAGS) /Fo$@ $**
12+
$(CC) $(CFLAGS) /Fo$@ $** /link /subsystem:$(SUBSYSTEM)
813

914
tee.obj: tee.c
1015
$(CC) $(CFLAGS) /c $**

src/version.c

+2
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static char *(features[]) =
761761

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1178,
764766
/**/
765767
1177,
766768
/**/

src/xxd/Make_mvc.mak

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# The most simplistic Makefile for Win32 using Microsoft Visual C++
22
# (NT and Windows 95)
33

4+
SUBSYSTEM = console
5+
!if "$(SUBSYSTEM_VER)" != ""
6+
SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER)
7+
!endif
8+
49
xxd: xxd.exe
510

611
xxd.exe: xxd.c
7-
cl /nologo -DWIN32 xxd.c
12+
cl /nologo -DWIN32 xxd.c -link -subsystem:$(SUBSYSTEM)
813

914
# This was for an older compiler
1015
# cl /nologo -DWIN32 xxd.c /link setargv.obj
1116

1217
clean:
13-
- if exist xxd.obj del xxd.obj
14-
- if exist xxd.exe del xxd.exe
18+
- if exist xxd.obj del xxd.obj
19+
- if exist xxd.exe del xxd.exe

0 commit comments

Comments
 (0)