Re: Problems compiling 64bit Vim using MSVC++ 2010 Express on Windows7 and statically linking Python3

109 views
Skip to first unread message

Tony Mechelynck

unread,
Sep 13, 2012, 10:31:43 AM9/13/12
to vim...@googlegroups.com, Gary Willoughby
On 13/09/12 15:19, Gary Willoughby wrote:
> I'm having some problems compiling 64bit Vim using MSVC++ 2010 Express on Windows7 and statically linking Python3.
>
> First i execute the msvc2010.bat batch file in the Vim /src/ dir to setup the environment.
>
> Then i call another script to setup the following environment variables:
>
> set GUI=yes
> set NETBEANS=no
> set FEATURES=HUGE
> set CPU=AMD64
> set WINVER=0x500
> set OLE=yes
> set PYTHON3=C:\Python32
> set PYTHON3_VER=32
> set DYNAMIC_PYTHON3=no
>
> Then i compile like this:
>
> nmake -f Make_mvc.mak
>
> This is the output:
>
> link /RELEASE /nologo /subsystem:windows /LTCG:STATUS -out:gvim.exe .\ObjGOHAMD64\blowfish.o
> bj .\ObjGOHAMD64\buffer.obj .\ObjGOHAMD64\charset.obj .\ObjGOHAMD64\diff.obj .\ObjGOHAMD64\digra
> ph.obj .\ObjGOHAMD64\edit.obj .\ObjGOHAMD64\eval.obj .\ObjGOHAMD64\ex_cmds.obj .\ObjGOHAMD64\ex_
> cmds2.obj .\ObjGOHAMD64\ex_docmd.obj .\ObjGOHAMD64\ex_eval.obj .\ObjGOHAMD64\ex_getln.obj .\ObjG
> OHAMD64\fileio.obj .\ObjGOHAMD64\fold.obj .\ObjGOHAMD64\getchar.obj .\ObjGOHAMD64\hardcopy.obj .
> \ObjGOHAMD64\hashtab.obj .\ObjGOHAMD64\main.obj .\ObjGOHAMD64\mark.obj .\ObjGOHAMD64\mbyte.obj .
> \ObjGOHAMD64\memfile.obj .\ObjGOHAMD64\memline.obj .\ObjGOHAMD64\menu.obj .\ObjGOHAMD64\message.o
> bj .\ObjGOHAMD64\misc1.obj .\ObjGOHAMD64\misc2.obj .\ObjGOHAMD64\move.obj .\ObjGOHAMD64\normal.o
> bj .\ObjGOHAMD64\ops.obj .\ObjGOHAMD64\option.obj .\ObjGOHAMD64\os_mswin.obj .\ObjGOHAMD64\os_wi
> n32.obj .\ObjGOHAMD64\pathdef.obj .\ObjGOHAMD64\popupmnu.obj .\ObjGOHAMD64\quickfix.obj .\ObjGOH
> AMD64\regexp.obj .\ObjGOHAMD64\screen.obj .\ObjGOHAMD64\search.obj .\ObjGOHAMD64\sha256.obj .\Ob
> jGOHAMD64\spell.obj .\ObjGOHAMD64\syntax.obj .\ObjGOHAMD64\tag.obj .\ObjGOHAMD64\term.obj .\ObjG
> OHAMD64\ui.obj .\ObjGOHAMD64\undo.obj .\ObjGOHAMD64\window.obj .\ObjGOHAMD64\vim.res .\ObjGOHAMD6
> 4\gui.obj .\ObjGOHAMD64\gui_beval.obj .\ObjGOHAMD64\gui_w32.obj .\ObjGOHAMD64\os_w32exe.obj .\Obj
> GOHAMD64\if_ole.obj .\ObjGOHAMD64\if_python3.obj .\ObjGOHAMD64/if_cscope.obj .\ObjGOHAMD6
> 4/xpm_w32.obj .\ObjGOHAMD64\version.obj oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib
> comdlg32.lib ole32.lib uuid.lib /machine:AMD64 /nodefaultlib gdi32.lib version.lib winspool.lib
> comctl32.lib advapi32.lib shell32.lib /machine:AMD64 /nodefaultlib libcmt.lib oleaut32.lib user32.
> lib C:\Python32\libs\python32.lib xpm\x64\lib\libXpm.lib /PDB:gvim.pdb -debug
> .\ObjGOHAMD64\blowfish.obj : fatal error LNK1112: module machine type 'X86' conflicts with target ma
> chine type 'x64'
> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.EXE"' :
> return code '0x458'
> Stop.
>
> It seems to be compiling the modules as 32bit? Is this right? Have i specified the correct environment variables? Any ideas how to solve this problem?
>

Untested:
Run "nmake clean", then edit bigvim64.bat if necessary (possibly under
another name), and run that.


Best regards,
Tony.
--
Q: Why do ducks have flat feet?
A: To stamp out forest fires.

Q: Why do elephants have flat feet?
A: To stamp out flaming ducks.

Gary Willoughby

unread,
Sep 13, 2012, 7:16:55 PM9/13/12
to vim...@googlegroups.com, Gary Willoughby
> Untested:
>
> Run "nmake clean", then edit bigvim64.bat if necessary (possibly under
>
> another name), and run that.

Thanks, this got me on the right track. I eventually realized that MSVC 2012 Express doesn't in fact come with the necessary tools for 64bit compiling so the modules are always compiled for 32bit, grrr.. apparently this has been a known issue on the MS forums.

To fix it i downloaded the latest Windows SDK for my platform (Windows 7) and then installed the new MSVisualStudio Express 2012 for Desktop which comes with the necessary tools and batch files. Then i modified the Vim make files to use the new versions, etc. So this is the batch file that compiled everything fine:

@ECHO OFF

REM For mods in the make files where i'm importing win32.mak:
SET SDK_INCLUDE_DIR=C:\Program Files\Microsoft SDKs\Windows\v7.1\Include

SET VC_DIR="C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC

ECHO "Setting up compiler..."
CALL %VC_DIR%\vcvarsall.bat" x86_amd64

ECHO "Setting up environment variables..."
SET CPUNR=i686
set WINVER=0x500
SET CPU=AMD64
SET GUI=yes
SET PYTHON=
SET PYTHON_VER=
SET DYNAMIC_PYTHON=
SET PYTHON3=C:\Python32
SET PYTHON3_VER=32
SET DYNAMIC_PYTHON3=no
SET IME=no
SET OLE=no
SET CSCOPE=no
SET NETBEANS=no
SET FEATURES=HUGE
SET OPTIMIZE=MAXSPEED

ECHO "Start compiling..."
CALL %VC_DIR%\bin\nmake" -f Make_mvc.mak

Reply all
Reply to author
Forward
0 new messages