Skip to main content
7-Zip can be built on Windows using Microsoft Visual Studio compiler (MSVC) and the nmake build tool.

Requirements

Compiler Options

Recommended: Visual Studio 2017, 2019, or 2022Supports building for: x86, x64, arm64, and arm platforms
Legacy compiler options:
  • Visual C++ 6.0 with Platform SDK (for x86)
  • Windows Server 2003 R2 Platform SDK (for x64 and ia64)
  • Standard SDK for Windows CE 5.0 (for arm/Windows CE)

Microsoft Macro Assembler

Required for optimized builds:
  • ml.exe - for x86 builds
  • ml64.exe - for x64 builds
Available in Windows SDK for Windows Vista or later versions.
If using MSVC 6.0, you must configure Platform SDK directories at the top of the directories list in:Tools → Options → Directories
  • Include files
  • Library files

Build Configuration

Makefile Variables

The following variables can be defined when compiling:
PLATFORM
string
Target platform: x64, x86, arm64, arm, or ia64
OLD_COMPILER
boolean
Set for old compilers like MSVC 6.0
Enable dynamic linking to msvcrt.dll (default is static linking)

Building All Binaries

1

Open Visual Studio Command Prompt

Navigate to the source directory and initialize the Visual Studio environment:
cd CPP\7zip
For x64 builds with Visual Studio 2022:
%comspec% /k "C:\Program Files\VS2022\VC\Auxiliary\Build\vcvars64.bat"
2

Run nmake

Build all 7-Zip binaries:
nmake
This compiles all targets in the UI and Bundles directories.

Other Platform Build Scripts

Use different vcvars*.bat files from VS2022\VC\Auxiliary\Build\ for other platforms:
%comspec% /k "C:\Program Files\VS2022\VC\Auxiliary\Build\vcvars64.bat"

Building Single Binary

To compile a specific binary, navigate to its project directory and run nmake.

Example: Building 7za.exe

1

Navigate to Project Directory

cd CPP\7zip\Bundles\Alone\
2

Initialize Build Environment

%comspec% /k "C:\Program Files\VS2022\VC\Auxiliary\Build\vcvars64.bat"
3

Compile

nmake
Output will be in the build directory (e.g., _o\ or similar).

Other Build Targets

cd CPP\7zip\Bundles\Alone2\
nmake

Build Options

Static vs Dynamic Linking

Default: Static linking to the C runtime library
nmake
Dynamic linking to msvcrt.dll:
nmake MY_DYNAMIC_LINK=1

Platform-Specific Builds

To explicitly set the platform:
nmake PLATFORM=x64
nmake PLATFORM=x86
nmake PLATFORM=arm64

Output Location

Compiled binaries are typically placed in subdirectories like:
  • _o\ - For default builds
  • b\ - For some makefile configurations
The exact output directory depends on the makefile and build configuration.

Troubleshooting

Error: “ml.exe not found” or “ml64.exe not found”Install Windows SDK that includes the Microsoft Macro Assembler. You can download it from the Microsoft website or install it via Visual Studio Installer.
Error: “Cannot find include files”If using MSVC 6.0, ensure Platform SDK directories are configured at the top of the include and library paths in Visual Studio settings.

Building Without Assembler

If assembler is not available, the C versions of optimized code will be used automatically, but performance may be reduced.

IDE Development

For development and debugging, you can use .dsp project files with Visual Studio:
  1. Open the .dsp file in Visual Studio
  2. Allow Visual Studio to upgrade the project if prompted
  3. Build using the IDE’s build commands
IDE builds are recommended for development only. Production builds should use makefiles for optimal compiler settings.

Next Steps

After building:

See Also

Build docs developers (and LLMs) love