Skip to main content

Overview

Sogen is built using CMake and supports a wide variety of platforms and compilers. This guide covers building from source on different operating systems.

System Requirements

All Platforms

  • CMake: 3.26.4 or higher
  • Git: For cloning with submodules
  • C++20 Compiler: See platform-specific requirements below
  • Rust (optional): For certain optimizations (can be disabled with -DMOMO_ENABLE_RUST_CODE=Off)

Platform-Specific Requirements

  • Visual Studio 2022 (or newer) with C++ development tools
  • Windows SDK
  • Administrator privileges (for registry dump)

Building on Windows

Using Visual Studio 2022

1

Clone the Repository

2

Open x64 Development Command Prompt

Start Menu → Visual Studio 2022 → x64 Native Tools Command Prompt for VS 2022
3

Generate Visual Studio Solution

This creates the solution at build/vs2022/emulator.sln
4

Build the Project

Choose one method:
5

Create Registry Dump

Run as administrator:
Then move the registry folder to artifacts:

Using MinGW on Windows

While you can build with MinGW, it’s recommended to cross-compile from Linux:

Building on Linux

Ubuntu/Debian

1

Install Dependencies

2

Clone the Repository

3

Build with GCC

Artifacts will be in build/release/artifacts/

Using Clang (Alternative)

1

Install Clang

2

Set Clang as Default

3

Build

Arch Linux

Fedora/RHEL

Building on macOS

Apple Silicon (arm64)

1

Install Xcode Command Line Tools

2

Install CMake

3

Clone and Build

Intel Mac (x86_64)

Same as Apple Silicon:

Advanced Build Options

Sogen provides several CMake options to customize your build:

CMake Build Options

Example: Optimized Build

Example: Debug Build with Sanitizers

Mobile and Embedded Platforms

iOS (arm64)

1

Install Rust Target

2

Build for iOS

Android

1

Install Android NDK

Download Android NDK r26d or newer from the Android NDK downloads page.
2

Set Environment Variables

3

Install Rust Target

4

Build

WebAssembly

Emscripten (Web)

1

Install Emscripten

2

Build for Web

Emscripten with Memory64

For programs requiring more than 4GB of memory:
Memory64 support is experimental and may not work in all browsers.

Emscripten for Node.js

Creating an Emulation Root

For proper emulation, Sogen needs a Windows system root with DLLs and registry.

On Windows

1

Run Creation Script

This creates a root folder with the Windows system directory structure.
2

Dump Registry (as Administrator)

3

Move Files

Using Pre-built Emulation Root

You can also download a pre-built emulation root from the CI artifacts:
  1. Go to GitHub Actions
  2. Find a successful build
  3. Download the “Windows 2022 Emulation Root” or “Windows 2025 Emulation Root” artifact
  4. Extract to build/release/artifacts/root

Running Tests

Verify your build works correctly:
For full test suite:

Test Environment Variables

Troubleshooting

Submodule Issues

If you forgot --recurse-submodules:

CMake Version Too Old

Rust Not Found

Install Rust:
Or disable Rust support:

Build Failures on macOS

Ensure you’re not generating universal binaries:

Out of Memory During Build

Reduce parallel jobs:

Next Steps

Quick Start

Learn how to use Sogen and run your first emulated program

Configuration

Explore advanced configuration options and command-line flags