Cross-Compilation
Kiln supports cross-compiling single executable binaries for different target architectures and operating systems using Bun’s native cross-compiler.
Supported Compilation Targets
Section titled “Supported Compilation Targets”| Target Flag | Architecture | Typical Use Case |
|---|---|---|
--target bun-linux-x64 |
Linux x86_64 | Standard cloud servers, Docker, AWS, VPS |
--target bun-linux-arm64 |
Linux ARM64 | AWS Graviton, Apple Silicon containers, Raspberry Pi |
--target bun-windows-x64 |
Windows x64 | Windows Server, Desktop Windows executables |
--target bun-darwin-arm64 |
macOS ARM64 | Apple Silicon macOS deployment |
--target bun-darwin-x64 |
macOS x64 | Intel macOS deployment |
Example Usage
Section titled “Example Usage”Via CLI Flag:
Section titled “Via CLI Flag:”# Compile for a Linux cloud serverkiln -o ./server-linux --target bun-linux-x64
# Compile for Windowskiln -o ./server-win.exe --target bun-windows-x64Via Environment Variable:
Section titled “Via Environment Variable:”You can also pass KILN_TARGET:
KILN_TARGET=bun-linux-x64 kiln -o ./bin/app