Repository navigation
chore(infra): add scripts/lab, a Linux lab for macOS development - #5
Merged
Merged
Conversation
Static musl builds, io_uring and kernel work are Linux-only, so on macOS every such check waited on a CI round trip. scripts/lab runs a command in the liam-lab OrbStack machine at the caller's directory, with a target directory per worktree under the VM user's home, and scripts/lab setup provisions the machine idempotently. The machine is aarch64, so the x86_64 musl target links with the x86_64 cross gcc, and mimalloc's C compiles against an x86_64 musl 1.2.5 built from upstream source (Ubuntu packages musl for the native architecture only). build:static now honours CARGO_TARGET_DIR. Refs: 0097
Review findings on the lab script. The musl prefix carried no version, so bumping musl_version kept compiling against the old headers. rustup-init was piped from curl, so a failed download ran an empty script, exited 0, and setup then failed with a bare 'rustup: not found'. Refs: 0097
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Development happens on macOS (Apple silicon), and everything liam ships is Linux: static musl binaries, io_uring, a kernel.
scripts/task build:staticrefuses to run on macOS, and anything touching io_uring or the kernel had to wait for a CI round trip. Parallel builders also need a place to run those checks without sharing a target directory.Approach
scripts/labdrives an OrbStack machine,liam-lab(Ubuntu 26.04, aarch64). OrbStack mounts/Usersat the same path, so a worktree is the same directory on both sides and nothing is copied.scripts/lab <cmd...>runs the command in the VM at the caller's directory, withPATHincluding~/.cargo/binandCARGO_TARGET_DIR=$HOME/.cache/liam-lab/target<worktree path>. Lab builds never touch the macOStarget/, and each worktree gets its own directory.scripts/lab setupis idempotent. It installs the packages the kernel and image work will need, rustup with the channel fromrust-toolchain.tomland both musl targets, and writes~/.cargo/config.tomlin the VM.x86_64-linux-gnu-gcc; Rust supplies musl's libc and start files. mimalloc's C needs x86_64 musl headers, and Ubuntu packages musl for the native architecture only. Plainx86_64-linux-gnu-gccfails (bits/libc-header-start.h: No such file or directory). So setup builds musl 1.2.5 from upstream source for x86_64, with itsmusl-gccwrapper, into~/.local/x86_64-linux-musl. That is the version in Rust's bundled libc.a. The tarball is pinned by sha256, and the hash matches Ubuntu'smusl_1.2.5.orig.tar.gz.scripts/task build:staticnow reads${CARGO_TARGET_DIR:-target}when it checks the binaries. That is the only change to a shared file, and CI behaves the same because it does not set the variable.Evidence
All of it is in the notes on cairn item 0097.
scripts/lab cargo test --workspace: exit 0, all six test binaries ok.scripts/lab scripts/task build:static: liamd 543,392 bytes and liam-init 397,880 bytes, bothELF 64-bit LSB pie executable, x86-64 ... static-pie linked, stripped. CI's static job gives 543,400 and 397,880 for the same code. Both binaries run in the lab under OrbStack's Rosetta binfmt, which exercises the cross-built mimalloc.IORING_OP_READand reapedres=9 user_data=42.io_uring_disabledis 0 on kernel 7.0.14-orbstack.ubuntu:resolutemachine was set up from nothing by this script, with only the machine name changed, in 1m33s. build:static then passed on it. A second setup took 0.74s and reinstalled nothing. The throwaway machine was deleted.orbon PATH, and with noliam-labmachine (a stub orb), the script exits 1 with the fix in the message. A command's exit status passes through.scripts/task checkis green on macOS.What to look at sceptically
musl_versioninscripts/labshould follow. CI's static job (native x86_64musl-gcc) stays the authority for what ships.scripts/lab scripts/task checkis not supported.site/node_moduleslives in the shared worktree and belongs to macOS, and the VM has no pnpm.--helpsays to runcheckon macOS.build:staticreads onlyCARGO_TARGET_DIR, notCARGO_BUILD_TARGET_DIRorbuild.target-dir. I left it: nothing here sets those, and reading cargo's resolved target directory would needcargo metadataplus a JSON parser.setupoverwrites~/.cargo/config.tomlin the VM. The VM exists for this, but anything hand-added there will be lost.setupruns at the same time would contend on apt's lock and on the musl prefix. Setup is a once-per-machine step, so I did not add locking.Refs: 0097