Chapter 23: Cross-Compilation
Wyn compiles via C, and the wyn cross command drives the right cross toolchain for each target - one command, no Makefile.
Cross-Compile Targets
bash
wyn cross linux-x64 app.wyn # Linux x86_64 (via zig cc)
wyn cross linux-arm64 app.wyn # Linux ARM64
wyn cross windows-x64 app.wyn # Windows (.exe)
wyn cross macos-x64 app.wyn # macOS Intel
wyn cross macos-arm64 app.wyn # macOS Apple Silicon
wyn cross ios app.wyn # iOS (requires Xcode SDK)
wyn cross android app.wyn # Android (requires NDK)
wyn cross wasm app.wyn # WebAssembly (requires Emscripten)All targets produce correct binary formats verified with file(1).
Optimized Builds
bash
wyn build app.wyn --release # -O3, full optimizations
wyn build app.wyn --fast # skip optimizations (fastest compile)Debugging
bash
wyn debug app.wynCompiles with DWARF debug info and launches lldb. You can set breakpoints on .wyn source lines and step through your code.
Architecture
.wyn → parse → check → AST → C → cc/zig cc/clang → machine codeThe compiler emits C, then invokes the appropriate compiler for the target: the bundled TCC or system cc for native builds, zig cc for Linux/Windows cross-builds, Xcode's clang for iOS, and the NDK's clang for Android.