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.
- 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
- You can get an old version of nmake in the self-extracting archive file http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.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.
- A newer version of nmake.exe that can handle long pathnames is part of the .NET Framework 1.1 Software Development Kit. Getting it requires first installing the .NET 1.1 runtime, and then using Internet Explorer and accepting installation of an ActiveX control at http://msdn.microsoft.com/netframework/downloads/updates/. Once you install the .NET Framework 1.1 Software Development Kit, copy the nmake.exe file that comes with it to a directory that is on your path, such as \perl\bin or the bin directory of the Visual C++ Toolkit.
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.