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:
string
Target platform: x64, x86, arm64, arm, or ia64
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:
For x64 builds with Visual Studio 2022:
2

Run nmake

Build all 7-Zip binaries:
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:

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

2

Initialize Build Environment

3

Compile

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

Other Build Targets

Build Options

Static vs Dynamic Linking

Default: Static linking to the C runtime library
Dynamic linking to msvcrt.dll:

Platform-Specific Builds

To explicitly set the platform:

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