Darik Horn - 2013-03-08

I recently needed to rebuild 7-Zip, but had some difficulty, and so wrote these instructions. The original document is at: https://docs.google.com/document/d/1jdVmxk5eUdNcSXPc3i-gI5gFITNSg_a5fdYEspKPuBE/edit?usp=sharing

For 32-bit 7-Zip Builds on Windows XP

This document is a step-by-step tutorial for building 7-Zip from source on Microsoft Windows.

Part A: Requirements

  • Microsoft Windows XP, Home Edition or Professional Edition
  • Microsoft Visual C++ 6.0 Professional Edition
    • Or Visual Studio 6 Professional Edition
    • Or Visual Studio 6 Enterprise Edition
  • Microsoft Visual Studio 6 Service Pack 5 (vs6sp5.exe)
  • Microsoft Visual C++ Processor Pack for Service Pack 5 (vcpp5.exe)
  • Microsoft Platform SDK February 2003 (PSDK-FULL.*.cab or the MSDN 2426.2 disc.)

The Visual C++ Processor Pack, which installs MASM 6.15 for Visual C++ 6.0, is incompatible with Standard Editions and Service Pack 6. Platform SDK releases after February 2003 are also incompatible.

Part B: Compiler Installation

Hint: Create an empty C:\WINDOWS\msjava.dll file to prevent Visual Studio 6 from installing the obsolete Microsoft JVM.

  1. Install Visual C++ 6.0 with the Typical configuration.
  2. Run Visual C++ 6.0 once to finalize the installation.
  3. Install vs6sp5.exe
  4. Install vcpp5.exe
  5. Extract the Platform SDK to a new PDSDK-FULL folder. Don’t use the web installer.
  6. Install PSDK-FULL\setup\CoreSDK-x86.msi
  7. Install PSDK-FULL\setup\PSDK-x86.msi
  8. Optionally install PSDK-FULL\setup\Dbg-x86.msi
  9. Click Start\All Programs\Microsoft Platform SDK February 2003\Visual Studio Registration\Register PSDK Directories with Visual Studio

The search paths in Visual Studio will be incorrect if you skip step 2.

Part C: Build Instructions

1. Unpack the 7z922.tar.bz2 source tarball to the C:\7z922 folder.

2. Disable the AesOpt.asm code, which requires Visual Studio 2008 Service Pack 1 or later. Edit the C:\7z922\CPP\7zip\Aes.mak file and change it to this:

C_OBJS = $(C_OBJS) \
  $O\AesOpt.obj $O\Aes.obj

#!IF "$(CPU)" != "IA64" && "$(CPU)" != "MIPS" && "$(CPU)" != "ARM"
#ASM_OBJS = $(ASM_OBJS) \
#  $O\AesOpt.obj
#!ENDIF

3. Click Start\All Programs\Microsoft Platform SDK February 2003\Open Build Environment Window\Windows XP 32-bit Build Environment\Set Windows XP 32-bit Build Environment (Retail)

4. At the command prompt, change directory into the Bundles folder:

C:\Program Files\Microsoft SDK> cd \7z922\CPP\7zip\Bundles

5. And compile the entire 7-Zip project like this:

C:\7z922\CPP\7Zip\Bundles> nmake NO_BUFFEROVERFLOWU=1 all

Build products are put in the \i386 folder of each bundle. (eg: C:\7z922\CPP\7zip\Bundles\Fm\i386\7zFM.exe)

Note that the top-level makefile does not have a clean rule.