I spent a good day trying to build 64-bit vim with Python support, and if I had just known these two tips, I could have saved an enormous amount of time:
- Install Microsoft .NET Framework 4.0
- Make sure Python is in your PATH
Part 1: Building Vim
I’ve built vim before, quite a few times. It’s not that different from building git. It does require some configuration, but it generally just works, without errors or warnings, whatever platform you build on.
Unfortunately, I fell victim to the Google school of debugging instead of debugging my problems on my own. It turns out that there is a “bug” in the Windows SDK 7.1 in that it does not install all of its dependencies. This has nothing to do with Vim specifically, it turns out this prevents you from building anything with a dependency on a resource file (.res).
Here’s a recipe for building vim on Windows 7 with the Microsoft SDK:
- Install Microsoft Windows SDK 7.1
- Install .NET Framework 4.0 (4.0. Not 4.5, not anything else, 4.0!)
- Open the Windows SDK 7.1 Command Prompt and run:
- Make sure you are in the 64-bit environment, and ensure that you can run the command:
- If you get this dialog, you didn’t follow step 2.
- Install the official 64-bit Python (2.7 series)
- Clone vim: hg clone https://vim.googlecode.com/hg/ vim
- Set up your environment for the build:
- 7. Build it, as per the instructions:
nmake -f Make_mvc.mak
You should have succesfully build a
gvim.exe. The trouble I ran into was this obscure error during the link phase:
fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
After Googling, I found that there was a compatibility problem, and it had something to do with .NET. But, I really had no idea what anyone was talking about other than the suggestion to use another version of
CVTRES.exe that I did not have. If I had just attempted to actually debug the problem, I could have set the
/VERBOSE flag and run the LINK command again to see what the problem was. This identified
CVTRES.exe as the culprit, and so I tried running CVTRES.exe. That’s when the error dialog finally popped up and it became obvious. The LINK program was ignoring the error from the program and somehow preventing it from popping up, and then telling me its output was invalid…
Building an NSIS installer did not work out-of-the-box. I had to make a number of modifications to the NSIS script to get it to work. I would have preferred to use the Cream installer script, but it doesn’t seem to be openly available. I’ve posted my modification on a fork on Bitbucket.
In the next episode, I’ll explain the details of how I was led astray by Python not working in my build (perhaps the blame does not fall entirely on me, though).