Building Vim with Visual Studio 2015

1,612 views
Skip to first unread message

Paul Moore

unread,
Apr 22, 2015, 3:03:44 PM4/22/15
to vim...@googlegroups.com
Has anyone tried building Vim with Visual C 2015 on Windows yet? I wanted to try building a copy of Vim with Python 3.5 enabled, just to see how well it worked - Python 3.5 uses VC 2015 to build, so I wanted to use the same version for Vim to avoid any weird C runtime clashes that might occur. And just for the interest :-)

There seem to be a number of issues:

1. Win32.mak is no longer available. I see that I can set SDK_INCLUDE_DIR to point to a version of it, but that means installing an old SDK or an old version of Visual Studio, so it's less than ideal...

2. The use of /nodefaultlib causes a load of "unresolved external symbol malloc" and similar issues. The C runtime has been reorganised in VC 2015, which maybe is why this is having issues.

Has anyone else tried to build with VC2015, and if so have you worked out how to fix these issues in a reasonable way? Just removing the use of /nodefaultlib *seems* to work, so I could use that for now, but I don't know if that could have problems that I haven't spotted.

Thanks,
Paul

Paul Moore

unread,
Apr 22, 2015, 5:46:57 PM4/22/15
to vim...@googlegroups.com
The following diff allows the build to succeed. You still need SDK_INCLUDE_DIR. Also, you have to build the GUI version with XPM=no, because the included libxpm binary appears not to be compatibile with the VC 2015 CRT (I don't know how to rebuild it, even if I could).

Paul

diff -r 3790fb70e04c src/Make_mvc.mak
--- a/src/Make_mvc.mak Tue Apr 21 19:10:49 2015 +0200
+++ b/src/Make_mvc.mak Wed Apr 22 22:44:25 2015 +0100
@@ -343,7 +343,7 @@
# gdi32.lib and comdlg32.lib for printing support
# ole32.lib and uuid.lib are needed for FEAT_SHORTCUT
CON_LIB = oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib \
- comdlg32.lib ole32.lib uuid.lib /machine:$(CPU) /nodefaultlib
+ comdlg32.lib ole32.lib uuid.lib /machine:$(CPU)
!if "$(DELAYLOAD)" == "yes"
CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib
!endif
@@ -446,6 +446,9 @@
!if "$(_NMAKE_VER)" == "12.00.21005.1"
MSVCVER = 12.0
!endif
+!if "$(_NMAKE_VER)" == "14.00.22609.0"
+MSVCVER = 14.0
+!endif
!endif

# Abort building VIM if version of VC is unrecognised.
@@ -460,7 +463,7 @@
!endif

# Convert processor ID to MVC-compatible number
-!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0") && ("$(MSVCVER)" != "10.0") && ("$(MSVCVER)" != "11.0") && ("$(MSVCVER)" != "12.0")
+!if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0") && ("$(MSVCVER)" != "10.0") && ("$(MSVCVER)" != "11.0") && ("$(MSVCVER)" != "12.0") && ("$(MSVCVER)" != "14.0")
!if "$(CPUNR)" == "i386"
CPUARG = /G3
!elseif "$(CPUNR)" == "i486"
@@ -484,6 +487,13 @@
LIBC =
DEBUGINFO = /Zi

+# Don't use /nodefaultlib on MSVC 14
+!if "$(MSVCVER)" == "14.0"
+NODEFAULTLIB =
+!else
+NODEFAULTLIB = /nodefaultlib
+!endif
+
!ifdef NODEBUG
VIM = vim
!if "$(OPTIMIZE)" == "SPACE"
@@ -655,7 +665,7 @@
GUI_LIB = \
gdi32.lib version.lib $(IME_LIB) \
winspool.lib comctl32.lib advapi32.lib shell32.lib \
- /machine:$(CPU) /nodefaultlib
+ /machine:$(CPU)
!else
SUBSYSTEM = console
!endif
@@ -976,7 +986,7 @@
!ENDIF

LINKARGS1 = $(linkdebug) $(conflags)
-LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
+LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(NODEFAULTLIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
$(LUA_LIB) $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(PYTHON3_LIB) $(RUBY_LIB) \
$(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)

Reply all
Reply to author
Forward
0 new messages