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
- Windows
- Linux
- macOS
- 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
build/vs2022/emulator.sln4
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
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: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
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:- Go to GitHub Actions
- Find a successful build
- Download the “Windows 2022 Emulation Root” or “Windows 2025 Emulation Root” artifact
- Extract to
build/release/artifacts/root
Running Tests
Verify your build works correctly:Test Environment Variables
Troubleshooting
Submodule Issues
If you forgot--recurse-submodules:
CMake Version Too Old
Rust Not Found
Install Rust: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