Skip to content

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)

All targets above produce correct binary formats verified with file(1).

WebAssembly is not supported. wyn cross wasm is accepted but requires Emscripten and the runtime still has POSIX dependencies; wyn build --wasm writes a native binary and reports success. See Cross-Compilation.

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.wyn

Compiles 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 code

The 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.

MIT License - v1.22.0