Repository navigation
Kairo 0.2.1
Warning
This is an alpha. It's the second public build of the self-hosted compiler, released so people can try Kairo, break it, and report what broke. The syntax, command-line flags and standard library will change before v1.
0.2.1 is a toolchain release: the language is the same as 0.2.0, whose notes cover the language, C/C++ interop and tools. What changed is how Kairo gets the C library and C++ runtimes for a target, how many targets it can build for, and how big the download is.
What's new
- macOS binaries run. 0.2.0's macOS tools were linked without an
LC_UUIDload command, so dyld refused to start them ("missing LC_UUID load command"). If you have 0.2.0 on a Mac, replace it with 0.2.1. ksys, sysroots built on demand. The first time you pass--target,kairoandkccbuild that target's C library and C++ runtimes (libc++, libc++abi, libunwind, compiler-rt) from sources that ship in the archive, then cache the result. It takes about 10 to 30 seconds, once. Instead of 18 prebuilt sysroots, the archive ships those sources plus prebuilt sysroots for its own platform, so downloads are 35 to 45% smaller.- 48 cross-compile targets, up from 18.
- glibc from source, any version from 2.17:
--target x86_64-linux-gnu.2.17(or-glibc2.17). Programs then run on that glibc or newer. - New architectures: Linux on PowerPC, s390x, MIPS, LoongArch, aarch64_be, riscv32 and x32, plus armv6 and thumbv7 musl.
- glibc from source, any version from 2.17:
- Your own platform works out of the box. On macOS, FreeBSD and NetBSD, where the archive carries no prebuilt sysroot, the first native build sets one up: on a Mac, from your installed SDK.
- MSVC without Visual Studio.
scripts/msvc-sysrootdownloads the MSVC runtime and Windows SDK straight from Microsoft through xwin, after you accept Microsoft's license, and caches them. - 17 LLVM backends, up from 5: X86, AArch64, ARM, RISC-V, WebAssembly, PowerPC, SystemZ, MIPS, LoongArch, SPARC, AVR, MSP430, BPF, NVPTX, AMDGPU, SPIR-V and Xtensa. With
--freestandingthat covers microcontrollers, eBPF and GPU object code. i128andu128on 32-bit targets (i686, 32-bit Arm, RISC-V 32, PowerPC 32, MIPS o32).f80formatting is back on x86, andf16,bf16andf128are formatted only where the target has them.- Fixes:
- A target spelled without an OS version (
x86_64-apple-macosx) now gets the release minimum instead of clang's very old default. - The Zig-style
.2.28glibc suffix no longer leaks into the clang triple. - armv7 Linux hosts no longer default to soft-float.
- Negative floats lost their sign when formatted on big-endian targets.
- A target spelled without an OS version (
Install
Quick install
Linux, macOS, FreeBSD and NetBSD (any shell):
curl -fsSL https://kairolang.org/install.sh | shWindows (PowerShell 5.1 or 7):
irm https://kairolang.org/install.ps1 | iexBoth are the same script, also attached below as install.sh and install.ps1. It detects your OS and CPU, downloads the matching archive and SHA256SUMS, verifies the checksum before unpacking, and never needs root or administrator rights. On Linux, macOS and the BSDs it installs to ~/.local/share/kairo/0.2.1 and links the tools into ~/.local/bin. On Windows it installs to %LOCALAPPDATA%\Kairo\0.2.1 and adds its bin to your user Path. Set KAIRO_PREFIX to install elsewhere, or KAIRO_TRIPLE to pick a different archive.
Downloads
Linux (the compiler is statically linked against musl and runs on any distribution)
| Architecture | Archive |
|---|---|
| x86_64 | kairo-0.2.1-x86_64-linux-musl.tar.xz |
| aarch64 | kairo-0.2.1-aarch64-linux-musl.tar.xz |
| armv7 | kairo-0.2.1-armv7-linux-musl.tar.xz |
| i686 | kairo-0.2.1-i686-linux-musl.tar.xz |
| riscv64 | kairo-0.2.1-riscv64-linux-musl.tar.xz |
Windows (MinGW builds; no extra runtime needed)
| Architecture | Archive |
|---|---|
| x86_64 | kairo-0.2.1-x86_64-windows-gnu.zip |
| aarch64 | kairo-0.2.1-aarch64-windows-gnu.zip |
| armv7 | kairo-0.2.1-armv7-windows-gnu.zip |
| i686 | kairo-0.2.1-i686-windows-gnu.zip |
macOS
| Architecture | Archive |
|---|---|
| Apple Silicon (arm64), macOS 11.0+ | kairo-0.2.1-arm64-apple-macosx11.0.zip |
| Intel (x86_64), macOS 10.15+ | kairo-0.2.1-x86_64-apple-macosx10.15.zip |
BSD
| Platform | Archive |
|---|---|
| FreeBSD x86_64 | kairo-0.2.1-x86_64-unknown-freebsd.tar.xz |
| FreeBSD aarch64 | kairo-0.2.1-aarch64-unknown-freebsd.tar.xz |
| NetBSD x86_64 | kairo-0.2.1-x86_64-unknown-netbsd.tar.xz |
The i686 builds need an SSE2-class CPU (Pentium 4 or newer), and the ARM builds need ARMv7 or newer.
To install by hand, download an archive and SHA256SUMS, verify it, unpack it anywhere and add its bin folder to your PATH:
sha256sum -c --ignore-missing SHA256SUMS
tar -xJf kairo-0.2.1-x86_64-linux-musl.tar.xz
export PATH="$PWD/kairo-0.2.1-x86_64-linux-musl/bin:$PATH"Keep the folder layout as it is: the tools find their libraries, runtime and sysroots relative to bin.
Archives downloaded with a browser may be blocked on first run on macOS and Windows; see Troubleshooting.
SHA-256 checksums
The same values as the attached SHA256SUMS (which covers the archives; the installers are listed here too). On macOS use shasum -a 256 <file>; on Windows, Get-FileHash -Algorithm SHA256 <file>.
| File | SHA-256 |
|---|---|
install.ps1 |
e1a5151933d2bd8a3bca24ddba0b277cb8e932c9c959715bdd16002a103f0d25 |
install.sh |
e1a5151933d2bd8a3bca24ddba0b277cb8e932c9c959715bdd16002a103f0d25 |
kairo-0.2.1-aarch64-linux-musl.tar.xz |
1800922954b603d805745ed884fb1562bcf6014e15793ca4dc0c77559f3083c9 |
kairo-0.2.1-aarch64-unknown-freebsd.tar.xz |
4b607969ef7903e7e422e1262cb4d2def52b8edea212544cb67bf13cf0f9a20a |
kairo-0.2.1-aarch64-windows-gnu.zip |
7604c2a1db175e1e8a30200a88ade3dcce49286a90fa79f6a6f59ba7cb797014 |
kairo-0.2.1-arm64-apple-macosx11.0.zip |
3804fa7af0eda5d521702684000273d1a6fee11b9a954ce84dc39ec84404189e |
kairo-0.2.1-armv7-linux-musl.tar.xz |
b252e45777f03903dbe044ce5cf5fbe788c3762e8fd6c9dbad0e5119e2b9b706 |
kairo-0.2.1-armv7-windows-gnu.zip |
f1ff7639786bd1a8170c78f2b407f53610503b322c8192bf906e9214dbfd0c77 |
kairo-0.2.1-i686-linux-musl.tar.xz |
5441e1865779c1270752eb53c679ca02b8da45e96958c1fc63c4b366785ef602 |
kairo-0.2.1-i686-windows-gnu.zip |
885d83b8f71c9dbb55fe81ade821a9cc16b539bec554e99a7648bbe93c42b3fe |
kairo-0.2.1-riscv64-linux-musl.tar.xz |
55c4e17e5648b68db0b324c9bc24f7639f4a9e945d41074a9b0c9ba42d3f5aad |
kairo-0.2.1-x86_64-apple-macosx10.15.zip |
a1e0c59cdf7fa8514afe97298b797389a610559d786b3ab4e7dee65298c0d207 |
kairo-0.2.1-x86_64-linux-musl.tar.xz |
fb76a0195eebcfa2c52e00ba1a50accb6be6335fdb8a765b86f6c32cda96e82e |
kairo-0.2.1-x86_64-unknown-freebsd.tar.xz |
b612ea22f31b9bb3f01983d72299c5538054835b5474211791d6afa0a94b945c |
kairo-0.2.1-x86_64-unknown-netbsd.tar.xz |
e18ec6a72b57d8d1626e6478450c1591f2dcef2704d8543f7167af63b5375d40 |
kairo-0.2.1-x86_64-windows-gnu.zip |
b0e7d4ef57f577dfa957f225728114b895a091cc3f11fdf50cdea1956e8d1b30 |
What's in the archive
bin/:kairo(the compiler),kcc(a clang-compatible C/C++ driver that can#include "x.k"),kld(the linker driver, for every object format),kfmt(the formatter),ksys(the sysroot generator),llvm-symbolizer,llvm-ar,llvm-ranlibandllvm-lib.lib/: Kairo'sbuiltin,stdandrtlibraries and the clang resource directory.sysroot/: prebuilt sysroots for the host platform only. Linux archives carry musl and glibc 2.31 for their own architecture, Windows archives their own MinGW sysroot, and macOS and the BSDs none. Every other target is built byksyson first use.share/kairo/sysroot/: the sources and recipesksysbuilds from: musl, glibc symbol lists, headers and start-file sources, mingw-w64, wasi-libc, Linux kernel headers, FreeBSD and NetBSD bases, and the runtime build tables. Each comes with its license.share/kairo/runtimes/: the LLVM runtime sources (compiler-rt, libc++, libc++abi, libunwind).scripts/:msvc-sysroot.sh/msvc-sysroot.ps1anddarwin-sysroot.sh, which set up MSVC and macOS sysroots from Microsoft's and Apple's SDKs. Those SDKs are never shipped.LICENSE,NOTICE,LICENSES/andTHIRD-PARTY-NOTICES.
Targets
Pass --target; ksys builds the sysroot the first time. ksys probe <target> shows how Kairo reads a target name.
| OS / libc | Architectures |
|---|---|
| Linux, musl (static) | x86_64, x32, i686, aarch64, aarch64_be, armv6, armv7, thumbv7, riscv64, riscv32, powerpc, powerpc64, powerpc64le, s390x, mips, mipsel, mips64, mips64el, loongarch64 |
| Linux, glibc 2.17–2.42 (riscv32 from 2.33, loongarch64 from 2.36) | x86_64, i686, aarch64, aarch64_be, armv7, riscv64, riscv32, powerpc, powerpc64, powerpc64le, s390x, mips, mipsel, mips64, mips64el, loongarch64 |
| Windows, MinGW (UCRT) | x86_64, i686, aarch64, armv7 |
Windows, MSVC (SDK via scripts/msvc-sysroot) |
x86_64, i686, aarch64 |
| macOS (your SDK) | arm64, x86_64 |
| FreeBSD 14.4 | x86_64, aarch64 |
| NetBSD 10.1 | x86_64 |
| WASI | wasm32 |
Linux programs build against glibc 2.31 by default, so they run on any distribution with glibc 2.31 or newer.
Known limitations (new in 0.2.1)
- The first build for a new target takes about 10 to 30 seconds while
ksysbuilds its sysroot. - The new glibc architectures (PowerPC, s390x, MIPS, LoongArch, aarch64_be, riscv32) are tested by linking, not by running. C++ on big-endian
powerpc64glibc doesn't link yet. - sparc64 and x32 glibc aren't available yet; x32 musl is.
- FreeBSD and NetBSD come from trimmed base-system files, so only FreeBSD 14.4 and NetBSD 10.1 are available.
thumbv7-linux-muslcode is compiled as 32-bit ARM (A32), not Thumb.- The macOS and MSVC setup has been tested on Linux (MSVC end to end through xwin, programs run under Wine) and with a real Mac for native builds and the SDK script; Windows with Visual Studio is untested.
- Everything listed in 0.2.0's known limitations still applies; the current list is on the Implementation Status page.
Troubleshooting
macOS: "cannot verify this app is free of malware" when running a downloaded release binary. Release binaries aren't notarized yet. If you downloaded the archive with a browser, clear the quarantine flag on the unpacked folder (the curl installer doesn't need this):
xattr -dr com.apple.quarantine ./kairo-0.2.1-arm64-apple-macosx11.0Windows: Defender or SmartScreen flags the downloaded binary. Release binaries aren't code-signed yet, so SmartScreen shows "Windows protected your PC" on first run. Click More info -> Run anyway. If Defender quarantines the archive outright, unblock it before extracting:
Unblock-File -Path .\kairo-0.2.1-x86_64-windows-gnu.zipThe PowerShell installer (irm https://kairolang.org/install.ps1 | iex) downloads without the browser's mark of the web, so it usually avoids both prompts.
kairo: command not found after installing. The installer links the tools into ~/.local/bin (on Windows it adds the install's bin folder to your user PATH). Open a new terminal, or add ~/.local/bin to PATH if your shell doesn't include it.
error [P008E] or [P009E] for a *-apple-macosx or *-windows-msvc target. Apple's and Microsoft's SDKs can't be redistributed. On a Mac, Kairo builds the macOS sysroot from your installed SDK automatically (install the Command Line Tools with xcode-select --install if it says none was found); from another host, run scripts/darwin-sysroot.sh against a copy of the SDK. For MSVC, run scripts/msvc-sysroot.sh (or msvc-sysroot.ps1 on Windows), which downloads the MSVC runtime and Windows SDK from Microsoft after asking you to accept its license.
error [P009E] when using --target. ksys refused to build a sysroot for that target. The message says why: --no-sysroot-build is set, the target isn't one Kairo supports yet, or the glibc version is out of range. ksys probe <target> shows what Kairo understood the target to be.
error [P010E] when using --target. Building the sysroot failed. The message names the stage that failed and its log directory, and the next build retries that stage. Please file an issue with the log.
Feedback
This is exactly what an alpha is for. Please file issues using the templates. If the compiler reports an internal error, paste the full output and the smallest file that reproduces it.
Report security issues privately, as described in SECURITY.md: through GitHub's private vulnerability reporting, or by email to security@kairolang.org.
License
Kairo is licensed under Apache-2.0 WITH AdditionRef-Kairo-Runtime-exception.
- Programs you compile with Kairo, and the code the compiler generates into them, are yours to license under any terms.