How to get a no-cost Windows build environment for spamc

Once you install perl and the required perl modules, you can install SpamAssassin from the source files (see InstallingOnWindows). When you perform the step of perl Makefile.PL, you are asked if you want to build spamc. You must answer "no" if you do not have the proper tools to build the spamc executable. Here is how you can get the tools from Microsoft at no cost. Before you do this, you should notice how much easier it is to just get a copy of spamc.exe from someone who has already built it.

1. Download and install Microsoft Visual C++ Toolkit 2003 from

Note: By default, the toolkit is installed in C:\Program Files\Microsoft Visual C++ Toolkit 2003\. Instead of accepting the default, install it in a a short pathname without spaces such as C:\VC2003. It will avoid certain problems in a later step. If you do install into the default directory you can rename or move the directory tree, but then you must edit the VCVARS32.BAT that comes with it.

You do not need to select the install option that registers path information in the environment.

2. Download and install the Core Platform SDK from

That download requires that you use Internet Explorer and accept installation of an ActiveX control.

Note: This also should be installed in a directory with a short name with no spaces, such as C:\SDK, not in the default. You can move or rename the directory tree after installing if you change environment variables that refer to the directory.

Edit the file VCVARS32.BAT that is in the Microsoft Visual C++ Toolkit 2003 directory to add the include and lib directories of the SDK that you just installed to the INCLUDE and LIB environment variables.

3. Download nmake.exe

Run it to create the files nmake.exe and nmake.err, which should both be placed in a directory that is in the Path, such as \perl\bin or the bin directory of the Visual C++ Toolkit. This version of nmake cannot handle long pathnames. If you installed the toolkit and SDK in short named directories, then that will be fine. An alternative is to use the short pathname equivalents when setting the INCLUDE and LIB environment variables.

That is hundreds of megabytes of download just to get nmake.exe if you don't want the .NET runtime and SDK for other reasons.

4. Using the build environment

When you want to build SpamAssassin with spamc, use the shortcut named "Visual C++ Toolkit 2003 Command Prompt" that is in the directory in which you installed the toolkit. Doubleclicking on it will open a command prompt window with the proper build environment in which you can install SpamAssassin and accept the option to build spamc.

BuildSpamcOnWindowsForFree (last edited 2009-09-20 23:16:29 by localhost)