Skip to content

build(just): link the dev stack against the static libkrun on Linux - #1108

Merged
norrietaylor merged 3 commits into
mainfrom
feat/dev-stack-static-minvmd
Jul 31, 2026
Merged

build(just): link the dev stack against the static libkrun on Linux#1108
norrietaylor merged 3 commits into
mainfrom
feat/dev-stack-static-minvmd

Conversation

@norrietaylor

@norrietaylor norrietaylor commented Jul 30, 2026

Copy link
Copy Markdown
Member

Stacked on #1070 (static musl libkrun), based on its branch. GitHub retargets to main when that merges. Independent of #1104 — this is the dev stack, that one is the release.

just up built minvmd against the dynamic upstream libkrun package and put ~/.krun on LD_LIBRARY_PATH. Linux users receive a static-musl binary. The dev stack was exercising a linkage nobody ships.

Same principle as the CI change: don't develop against a configuration we don't distribute. Beyond the obvious "works locally, breaks in release" risk, it meant the merge-and-objcopy-localize pass that produces libkrun.a — the part most likely to misbehave at runtime — was never once hit by day-to-day development.

Changes

recipe before after
libkrun-static new: builds libkrun.a from the vendored pin into .scratch/libkrun-static/<triple>
minvmd-build (Linux) dynamic, LIBKRUN_PREFIX=~/.krun musl target, static archive, MINVMD_REQUIRE_LIBKRUN=static
test-vm (Linux) dynamic same as above — a true twin of ci-linux-kvm's test job
clean also removes the built archive

Two details worth calling out:

clean removes libkrun.a. It is keyed to the vendored pin, so a stale one would silently outlive a pin bump — exactly the failure the CI composite avoids by hashing the pin into its cache key.

minvmd moves to target/<triple>/debug on Linux, so minvmd-dir now leads PATH. min still autospawns minvmd by bare name, and every other recipe is unchanged.

LD_LIBRARY_PATH export removed. A static minvmd dlopens nothing; there is nothing for the loader to resolve.

What stays

The libkrun fetch recipe remains. nightly-tests.yml still builds against the upstream dynamic package, and this is how you reproduce that locally — it is just no longer on the dev stack's path.

macOS is untouched: it ships a dylib and keeps the native debug dir.

Verification

just --evaluate resolves the new variables correctly and every recipe parses. AGENTS.md's recipe map is updated (count, libkrun, new libkrun-static, minvmd-build).

Not verified locally: the Linux branch of the minvmd-dir conditional and the recipes themselves — this is a macOS host, where [linux] recipes don't run. ci-linux-kvm exercises the same script and target via #1104.

Refs #1065

🤖 Generated with Claude Code

Note

Link the Linux dev stack against a static libkrun built for the musl target

  • Adds a new libkrun-static recipe in justfile that builds libkrun.a for the musl target into .scratch/libkrun-static/<musl-triple>, skipping the build if the artifact already exists.
  • Changes the Linux minvmd-build recipe to depend on libkrun-static and build with --target <musl-triple>, setting MINVMD_REQUIRE_LIBKRUN=static and LIBKRUN_PREFIX to the static artifact directory.
  • Updates minvmd-dir to resolve to target/<musl-triple>/debug on Linux and target/debug on macOS, and removes LD_LIBRARY_PATH from the exported environment.
  • Updates test-vm on Linux to run cargo nextest with --target <musl-triple> and the static libkrun environment variables instead of the dynamic prefix.
  • Behavioral Change: the Linux dev environment no longer sets LD_LIBRARY_PATH and the produced minvmd binary is now a musl-linked static executable.

Macroscope summarized e1ad56d.

@norrietaylor
norrietaylor requested a review from a team as a code owner July 30, 2026 20:49
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 52 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dca65ddf-0efa-4d10-8a8f-ca8be116c095

📥 Commits

Reviewing files that changed from the base of the PR and between 63cb4e9 and e1ad56d.

📒 Files selected for processing (1)
  • justfile

Comment @coderabbitai help to get the list of available commands.

@norrietaylor
norrietaylor force-pushed the feat/dev-stack-static-minvmd branch from f170503 to d6098d3 Compare July 30, 2026 21:04
Base automatically changed from feat/static-musl-libkrun to main July 31, 2026 05:02
norrietaylor and others added 3 commits July 30, 2026 22:05
`just up` built minvmd against the DYNAMIC upstream libkrun package and
put ~/.krun on LD_LIBRARY_PATH. Linux users receive a static-musl
binary, so the dev stack was exercising a linkage nobody ships.

Same principle as the CI change: don't develop against a configuration
we don't distribute. Aside from the obvious "works locally, breaks in
release" risk, it means the merge-and-objcopy-localize pass that
produces libkrun.a — the part most likely to misbehave at runtime — was
never once hit by day-to-day development.

- `libkrun-static` builds libkrun.a from the vendored pin into
  .scratch/libkrun-static/<triple>, skipping when present. `clean`
  removes it: the archive is keyed to the pin, so a stale one would
  silently outlive a pin bump.
- `minvmd-build` (Linux) builds for the musl target against it, with
  MINVMD_REQUIRE_LIBKRUN=static so a missing archive is an error rather
  than a runtime-bailing stub.
- `test-vm` (Linux) does the same, keeping the recipe a true twin of
  ci-linux-kvm's test job now that lane is static too.
- minvmd lands under target/<triple>/debug on Linux, so `minvmd-dir`
  leads PATH — `min` still autospawns `minvmd` by bare name.
- The global LD_LIBRARY_PATH export is gone. A static minvmd dlopens
  nothing, so there is nothing for the loader to resolve.

The `libkrun` fetch recipe stays: nightly-tests.yml still builds against
the upstream package, and this is how you reproduce that locally. It is
just no longer on the dev stack's path.

macOS is untouched — it ships a dylib and keeps the native debug dir.

Refs #1065

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A static minvmd dlopens nothing, so dropping the LD_LIBRARY_PATH export was
right, but the `env` recipe still expanded $LD_LIBRARY_PATH. just runs recipes
under `sh -cu`, so the now-unset variable aborted the recipe with "parameter
not set" on Linux and macOS alike, breaking the documented
eval "$(just env)" flow.

Every other $VAR the justfile's recipes reference is still exported; this was
the only orphan.

Also correct AGENTS.md's recipe count to 41, which is what `just --summary`
reports here (the number was already stale before this branch).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
main dropped AGENTS.md's hand-maintained recipe list in favour of `just
--list`, which cannot drift. That makes each recipe's caption (the last comment
line above it) the actual documentation, and four of the recipes this branch
touches ended their comment block mid-explanation:

    clean         # would silently outlive a pin bump.
    libkrun       # you reproduce that locally.
    minvmd-build  # makes a missing libkrun.a an error rather than a silent ...

Reorder to the convention the justfile already uses elsewhere (`artifacts`,
`minvmd-build` on macOS): rationale first, blank comment line, caption last.
No behaviour change; only the comment blocks move.
@norrietaylor
norrietaylor force-pushed the feat/dev-stack-static-minvmd branch from ea8c505 to e1ad56d Compare July 31, 2026 05:07
@norrietaylor
norrietaylor enabled auto-merge (squash) July 31, 2026 05:08
@norrietaylor
norrietaylor merged commit 8cabd3a into main Jul 31, 2026
30 checks passed
@norrietaylor
norrietaylor deleted the feat/dev-stack-static-minvmd branch July 31, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants