Repository navigation
fix(scripts): build libghostty-vt for the baseline CPU - #55
Conversation
The v0.1.0-beta.4 linux-x64 prebuild crashes with SIGILL on CPUs without AVX-512. build-libghostty-vt.sh passed no -Dcpu, so Zig compiled for the release runner's CPU (14,870 AVX-512 instructions in the addon). Under qemu-user with a Skylake or generic x86-64 CPU, loading it and creating a terminal dies with exit 132. libghostty-vt now builds with -Dcpu=$LIBGHOSTTY_VT_CPU (default baseline) and records the CPU in ghostty-source.json. A baseline build has no AVX-512; its only AVX2 code is wuffs' runtime-dispatched *_x86_avx2 functions. scripts/check-baseline-cpu.sh runs examples/smoke.ts in one Node process under qemu-x86_64 -cpu qemu64. The linux-x64 CI job runs it against build/Release and the linux-x64 release-prebuilds job against prebuilds/. It exits 1 for the beta.4 prebuild and 0 for a baseline build. Change-Id: I21af6fdcb2575f9eededee641c1377a9b96a1c55 Signed-off-by: Thomas Kosiewski <tk@coder.com>
Change-Id: Ie403aa95e2c132f64c7d5d2712e82e2f3f440dc1 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Change-Id: I4fcd37fee02f3f0d0711a8eb1f8e5185e5aafaea Signed-off-by: Thomas Kosiewski <tk@coder.com>
Node without the addon dies with SIGILL under qemu64 on ubuntu-latest, which installs Ubuntu's amd64v3 packages. Haswell has AVX2 and no AVX-512: the baseline build passes there and the beta.4 prebuild exits 1. Change-Id: Ibba3fc73e3f99a33feabf21d5e011e060bfb2790 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
GitHub retires the macos-14 image on 2026-11-02 and cancels macos-14 jobs during scheduled brownouts (actions/runner-images#13518). Change-Id: I83ce63b89a76cd4d3c2ab35235edf96b6f539acd Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
Change-Id: I4fca59a13415733dfc6cde9137fa477708786e5e Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f599131452
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Verdict: PASS+NOTES Heads: I built and tested Host: AMD EPYC 9454P with AVX-512, so only the emulated runs count. qemu-user 9.2.1 (Ubuntu Checks
Notes (none block this PR)
Generated with |
release-prebuilds.yml is manual-dispatch only. publish.yml builds the files npm ships, so check them there before upload. Also ignore qemu-user core dumps that a failing check leaves in the repo root. Change-Id: I9829884cc978c609a408bb5c593aa91348be86d7 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Ghostty's build replaces a native macOS target with a generic one, so the CPU override only changes Linux builds. Change-Id: I9fa9f9db966b53fb26462176e644fa3936310b99 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
beta.4's linux-x64 prebuild was built for an AVX-512 CPU and died with SIGILL on CPUs without it (coder/libghostty-vt-node#55). beta.5 builds libghostty-vt for the baseline CPU: 0 AVX-512 instructions, and it runs under an emulated Haswell and Skylake.
Why
coder/agent-tty#179 (native mouse input) needs
encodeMouse, which first shipped in beta.2. With beta.4, agent-tty's Linux CI crashes. Thelinux-x64prebuild dies withIllegal instruction(SIGILL) on CPUs without AVX-512. That breaks the default libghostty-vt renderer for those users too, and it blocks the agent-tty PR.Cause
scripts/build-libghostty-vt.shpassed no-Dcpu, so Zig compiled libghostty-vt for the release runner's CPU. The beta.4 addon contains 14,870 AVX-512 (zmm/mask register) instructions. Measured withobjdump -d, beta.0 has none. GitHub's x64 runners differ in CPU features, so this repo's own CI passed because its runner had AVX-512 (inferred).Reproduction with
qemu-x86_64on an AVX-512 host:-cpu Skylake-Client(AVX2, no AVX-512)-cpu qemu64(generic x86-64)baselinebuildWhat changes
build-libghostty-vt.shpasses-Dcpu=$LIBGHOSTTY_VT_CPU(defaultbaseline) and recordscpuinghostty-source.json. A baseline build has no AVX-512. Its only AVX2 code is wuffs'*_x86_avx2functions, which wuffs selects at run time after a CPUID check.scripts/check-baseline-cpu.sh(mise taskcheck-baseline-cpu) runsexamples/smoke.tsin one Node process underqemu-x86_64 -cpu qemu64. It starts the real Node binary (process.execPath), because qemu-user emulates only the binary it starts, and a mise shim would exec Node natively and pass any addon. Thelinux-x64job ofci.ymlruns it againstbuild/Release. Thelinux-x64jobs ofpublish.yml(the files npm ships) and of the manualrelease-prebuilds.ymlrun it againstprebuilds/withPREBUILDS_ONLY=1, before the artifact is uploaded..gitignoreignores theqemu_*.coredumps (about 700 MB each) that a failing check leaves in the repo root.QEMU_CPU=Haswell(AVX2, no AVX-512). Onubuntu-latest, Node without the addon dies with SIGILL underqemu64. The script's control step (node -e 0under the same CPU, exit 2) showed this in CI. The runner installs Ubuntu'samd64v3packages, which is the likely cause (inferred). Locally the defaultqemu64passes for the baseline build. Under Haswell the baseline build passes and the beta.4 prebuild exits 1.qemu-user. Ubuntu 26.04 (ubuntu-latest) no longer hasqemu-user-static.qemu-userprovides/usr/bin/qemu-x86_64on 24.04 and 26.04.scripts/README.md, the README build section, and the CHANGELOG[Unreleased]entry.ci.yml,release-prebuilds.ymlandpublish.ymlrun themacos-arm64row onmacos-15. GitHub cancelled everymacos-14job on this PR during a scheduled brownout, and it retiresmacos-14on 2026-11-02 ([macOS] The macOS 14 Sonoma based runner images will begin deprecation on July 6th and will be fully unsupported by November 2nd for GitHub Actions and Azure DevOps actions/runner-images#13518). Without this change the beta.5 release would have no macOS prebuild.Validation (local, x86_64 Linux, AMD EPYC 9454P)
npm run build:libghostty,build:native,build,typecheck,npm test(86/86) andnpm run smokepass.mise run check-baseline-cpuexits 0 on the baseline build, also withQEMU_CPU=Skylake-ClientandQEMU_CPU=Nehalem.prebuilds/copied in andPREBUILDS_ONLY=1, the check exits 1 and prints its error. An earlier draft of the script usedcommand -v node, got the mise shim, and passed beta.4. That is why it now resolvesprocess.execPath.Follow-up
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:high