ourc Node: 4 Building from hex Next: (end) Prev: 3 Limitations Up: Top

4 Building from hex

A prebuilt ourc is attached to the v0.1.1 release with its SHA256SUMS. To check that binary rather than trust it, rebuild it from 269 bytes of hand-written machine code.

Every compiler in the tower is built from tower/L0/hex0/hex0.hand.hex, and every artifact is checked against its pinned sha256.

4.1 One command

$ bash ourc/release.sh OUT                    # the shell build
$ cargo run --release \
    --manifest-path ourc/bootstrap/Cargo.toml \
    -- --repo . OUT                           # the Rust driver, with a live dashboard

Either one builds every compiler in the tower from the hand-written hex, checks each artifact against its pinned sha256 in bootstrap/pins.txt, and ends with ourc compiling itself to a byte-identical fixed point. The driver is also on crates.io: cargo install ourc-bootstrap && ourc-bootstrap OUT.

machinex86-64 Linux with at least 24 GB of RAM; ourc compiling itself peaks near 20 GB.
toolsllc and opt from LLVM 16 or newer, and cc, on PATH.
timeAbout 20 minutes on a 32-core machine; on 4 cores, over an hour.

4.2 The hash

The build ends with ourc compiling itself to a fixed point, and this hash:

9d5fde72 d8e5a492 9bd929c2 165b339c
2adf054a b8d80672 f0252a2d 74074078
sha256 · ourc-v0.1.1-x86_64-linux/ourc

It was produced with LLVM 22.1.8, GCC 16.2.1, binutils 2.47 and glibc 2.44. Five of the 60 pinned artifacts pass through those host tools, so another toolchain builds a different, equally checked ourc hash, reported as host drift. The 55 tower artifacts, the LLVM-against-hex check and the self-compile fixed point must still match exactly. Each build records its toolchain in PROVENANCE.

4.3 A measured build

One full release.sh run from the hand-written hex on an AMD Ryzen AI Max+ 395, 16 cores and 128 GB, under CachyOS: 19 min 51 s, peaking at 20.8 GB for the whole build.

The tower: hex0 up to L6, then SEM0’s 28 hops and fixed points1.8 GB
SEM0 lowered to LLVM, checked against the hex-built SEM06.7 GB
SEM0 builds ourc4.7 GB
ourc compiles itself three times20.4 GB

Measured with ourc/measure-build.sh: a systemd scope sampled once a second, plus the kernel’s own memory.peak for the scope.

4.4 The trust gate

tower/backend-toolchain/provenance.sh re-derives the whole chain from the hand-written hex inside the gate, and checks it by diverse double compilation: the code generator is built by two different compilers, which must agree byte for byte. The host’s LLVM is admitted only by result, when the LLVM-built SEM0 emits byte-identically to the hex-rooted one.

$ SP=<scratch> bash tower/build-tower.sh --gates   # every gate, ending on the trust gate