Compilation targets
Native binaries, cross-compilation, and WebAssembly.
Native (default)
clang + the Nyra runtime — full stdlib, timing, memory, channels.
Cross-compilation
Build a release binary for another OS while developing on macOS, Linux, or Windows:
nyra build . --release --for windows
nyra build . --release --for linux
nyra build . --release --for macos
nyra build . --release --os linux --arch aarch64
Advanced: full LLVM triple with --target x86_64-unknown-linux-gnu (overrides --for).
Cross artifacts: target/<triple>/release/main (adds .exe on Windows). nyra run cannot execute foreign binaries.
| From → To | Toolchain notes |
|---|---|
| macOS → Linux | Cross GCC toolchain + clang (e.g. brew install messense/macos-cross-toolchains/aarch64-unknown-linux-gnu) |
| macOS / Linux → Windows | MinGW-w64 + clang; Windows target uses *-pc-windows-gnu (not MSVC cross) |
| Linux / Windows → macOS | Requires osxcross + Apple SDK (advanced) |
| Any → Wasm | LLVM clang with wasm32-wasi (Apple clang lacks this — use Homebrew llvm) |
Optional: set NYRA_SYSROOT or pass --link-arg for custom sysroots.
Windows cross-compile (--for windows, MinGW *-pc-windows-gnu): hello, print, file I/O, spawn (Win32 threads), TCP/HTTP (Winsock2), and async/await (Win32 sync + select socket I/O). Run the resulting .exe on Windows or Wine. Bridge subprocess (bridge_exec) remains POSIX-only.
wasm32-wasi
nyra build --for wasm app.ny -o app.wasm
nyra build --target wasm32-wasi app.ny -o app.wasm
Timing/memory no-ops; spawn limited.