Skip to content

About

Fix "Illegal instruction (core dumped)": opencode 2.x, Cline CLI and Bun rebuilt for old x86-64 CPUs without SSE4.2/AVX (Core 2 Duo, Pentium Dual-Core, Celeron, Athlon 64, Phenom II) on Linux

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

41 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

legacy-cpu-agents

AI coding agents — opencode, Cline CLI, Antigravity CLI — on old x86-64 PCs: Core 2 Duo/Quad, Pentium Dual-Core, Celeron, Athlon 64 X2, Phenom II and anything else without SSE4.2/POPCNT/AVX.

Current builds

Tool Version Release
Bun 1.4.5 bun-v1.4.5-legacy
opencode 2.4.2 opencode-v2.4.2-legacy
opencode, 1.x line 1.19.6 opencode-v1.19.6-legacy
Cline CLI 3.0.76 cline-v3.0.76-legacy

The installer takes the newest of each. See Changes for what was done and what is still open.

Symptoms this fixes

On an old PC, opencode, cline, bun or agy dies right away with one of:

Illegal instruction (core dumped)
zsh: illegal hardware instruction  opencode
panic(main thread): Illegal instruction at address 0x...
CPU lacks AVX support, strange crashes may occur

Typical CPUs: Intel Core 2 Duo / Core 2 Quad, Pentium Dual-Core (E2xxx/E5xxx/E6xxx), Celeron (E1xxx/E3xxx), Xeon 5100/5300/5400; AMD Athlon 64 X2, Athlon II, Phenom / Phenom II, Turion 64 X2, Opteron (before Bulldozer). Check yours with grep -o -w 'sse4_2\|cx16' /proc/cpuinfo | sort -u: if sse4_2 is missing, the official builds can't run; if cx16 is there, these can. (The first single-core Athlon 64s and early 64-bit Pentium 4s lack cx16.)

Why the official builds crash (Illegal instruction (core dumped))

opencode and Cline are bun build --compile executables: the Bun runtime is inside them. Bun 1.4's only x64 build is its "baseline", compiled with -march=nehalem (2008): SSE4.1, SSE4.2 and POPCNT are assumed everywhere, in Bun's Rust and C++ code, its dependencies and JavaScriptCore. A Pentium Dual-Core / Core 2 has SSSE3 at most, so the very first such instruction kills the process. (opencode's -baseline npm package even ships the same binary as the regular one, AVX2 included.)

What this repo does

Rebuilds the whole stack from upstream sources with one change of CPU floor — -march=x86-64 -mcx16 -msahf (SSE2 + CMPXCHG16B + LAHF/SAHF, the Windows 10 floor) — and nothing assumed above it:

Workflow Builds From
1. WebKit JavaScriptCore + ICU (Bun's bun-webkit-linux-amd64) oven-sh/WebKit at the commit the Bun release pins, its own Dockerfile and toolchain image, MARCH_FLAG changed, plus two patches: WebAssembly floor/ceil/trunc/nearest used roundss/roundsd (SSE4.1) without a CPU check in the interpreter (IPInt) and the BBQ/OMG JITs; both now fall back to SSE2
2. Bun bun 1.4.x oven-sh/bun + patches/bun: the CPU floor (C/C++, Rust target-cpu/features), libspng's SSE4.1 filter level, the WebKit download URL, and bun's own static ISA verifier lowered to SSE2
3. Apps opencode (1.x and 2.x), cline their own release build scripts, run by the legacy bun so --compile embeds it; opencode 2.x (packages/cli) is built as upstream's release workflow does, models catalog first; Cline gets one patch that disables auto-update to the official AVX build, and the build step makes node-machine-id read /proc/sys/kernel/hostname instead of running hostname, which Arch lacks. Cline's build refuses to run when its bundled license notices are for another Bun version, so its own update-bun-runtime.ts rewrites them first
5. Installer — runs install.sh for real on every change to it and starts each tool
6. Whole system — a whole Linux VM on an emulated Core 2: see below
4. Antigravity — agy is closed source (Go + C++ built for x86-64-v2): it SIGILLs on a Core 2 at its first SSE4.1 pmulld. The installer runs the official binary through qemu-x86_64 -cpu max when it detects that

JavaScriptCore's JIT already picks SSE4.1/POPCNT/AVX at run time from CPUID, and SIMD-heavy libraries (simdutf, highway, BoringSSL, zlib-ng, zstd, libjpeg-turbo) dispatch at run time too, so lowering the compile-time floor is enough: nothing is slower on a modern CPU except code the compiler would have auto-vectorized.

How it is verified

Every binary is run under QEMU user-mode emulation of Conroe (Core 2 / Pentium Dual-Core), Opteron_G2 (Athlon 64 X2) and a bare SSE2 floor model; QEMU raises SIGILL for any instruction the model lacks, as real hardware does. A control run of the official binary on the same model must SIGILL, proving the check bites.

  • ci/jit-smoke.js drives JSC through LLInt → Baseline → DFG → FTL on rounding/clz/typed-array/string/BigInt/wasm code, plus Intl (ICU).
  • ci/bun-smoke.ts covers BoringSSL (AES-GCM, RSA, ECDH, Ed25519, TLS fetch), simdutf, highway JSON, hashing, argon2/bcrypt, zlib/brotli/zstd, sqlite+FTS5, the bundler and CSS parser, Bun.Image codecs, the shell, workers, Bun.serve/WebSocket.
  • ci/same-runtime.sh proves each app embeds the legacy runtime byte-for-byte (.text).
  • opencode: CLI commands, serve HTTP API (1.x), and the full TUI in a pseudo-terminal; Cline: CLI, hub, full TUI.

What opencode 2.x adds

opencode 2.x embeds prebuilt native parts besides Bun: OpenTUI, opencode-pty (a separate program it starts), the file watcher, Iroh and the fff file finder. They are not rebuilt here. The 2.x job counts the instructions above the floor in each (ci/isascan.sh); several contain AVX and SSE4.1 code. In every run so far they chose a path the old CPU supports: no illegal instruction was ever raised. opencode-pty is also started on its own on the emulated CPUs.

The whole-system test

QEMU's user-mode emulation does not follow a program into the programs it starts: opencode's opencode-pty daemon and background service, and Cline's hub, ran on the CI machine's own modern CPU. Workflow 6. Whole system closes that gap. It boots an Ubuntu VM under QEMU system emulation without KVM as a Core 2 (-cpu Conroe,+cx16; QEMU's model leaves out CMPXCHG16B, which the real chips have), checks that the official Bun dies there with an illegal instruction, runs install.sh, then uses each tool (ci/vm-tests.sh): Bun scripts, package installs and bundling, opencode's models, file finder, terminal service, background service and both TUI modes, Cline's hub and TUI. Afterwards the VM's kernel log must hold no invalid opcode from any process.

Results so far, over seven runs:

  • No illegal instruction from any of these builds, in any process.
  • Time limits are tight on a very slow machine. opencode 2.x's TUI once gave up with ECONNREFUSED because the background service it had just started was not ready; with the service already running it was fine. cline hub start sometimes hits its 15-second limit. The emulator is far slower than a real Core 2, so this may not happen on real hardware; if it does, run the command again.
  • Multi-threaded emulation crashes JIT programs by itself. With four emulated cores (thread=multi), about 1 start in 30 died with a segmentation fault or Unexpected code block in DFG->FTL tier-up. The same happened on an emulated modern CPU (cpu=max), with the previous builds, and with the official, unmodified opencode (3 of 60 starts), so it is not caused by these builds. The test now uses one core and thread=single, and showed no such crash. The stress input repeats the starts and counts failures, with the official builds included when the emulated CPU can run them.

Emulation proves which instructions run. It does not reproduce the timing of a real old PC: that is the final test.

Install on the old PC

Any 64-bit (x86_64) Linux: Debian, Ubuntu, Mint, Arch Linux, Fedora, openSUSE... Three steps:

1. Run the installer

curl -fsSL https://raw.githubusercontent.com/Ulmaria/legacy-cpu-agents/main/install.sh | bash

That installs all four: bun, opencode, cline and agy. They are downloaded at the same time, then installed one by one. For only some of them, list them at the end:

curl -fsSL https://raw.githubusercontent.com/Ulmaria/legacy-cpu-agents/main/install.sh | bash -s -- opencode cline

2. Open a new terminal

The terminal you installed from still remembers the old programs. Close it and open a new one.

3. Check that the right versions run

which -a opencode cline

The first line for each must be in ~/.local/bin, for example /home/you/.local/bin/opencode. Then run opencode or cline.

Already had opencode or Cline installed?

If you installed the official opencode or Cline before, those copies are still on the PC. They are the ones that crash with Illegal instruction (core dumped), and they can shadow (hide) the new builds: typing opencode runs whichever copy your PATH finds first.

The installer handles this for you:

  • it adds a line at the end of ~/.bashrc (and ~/.zshrc and fish's config.fish if you use them) that puts ~/.local/bin first;
  • it lists every older copy it finds, each with the exact command that removes it.

Removing the old copies is optional once the new ones come first, but it avoids confusion. The usual places are:

Old copy came from Where it lives Remove with
npm (npm i -g opencode-ai / npm i -g cline) npm's global folder npm uninstall -g opencode-ai cline
opencode's own installer (curl https://opencode.ai/install) ~/.opencode/bin rm -rf ~/.opencode, then delete its PATH line in ~/.bashrc
Bun (bun add -g ...) ~/.bun/bin bun remove -g opencode-ai cline

If which -a still shows the old copy first in a new terminal, run hash -r (it clears the shell's memory of where programs are) or run the installer again.

Good to know

  • Don't run opencode upgrade. It would replace this build with the official one, which crashes on old CPUs. Cline's auto-update is already turned off in this build.
  • To update later, just run the installer again: it always fetches the newest builds from this repo.
  • If the installer says it could not list the releases, GitHub is limiting anonymous requests from your address (common on shared connections). Wait a few minutes, or set GITHUB_TOKEN to a GitHub token first.
  • On a slow PC, if opencode exits with ECONNREFUSED or cline hub start times out, run it again: the background part was still starting.
  • Antigravity (agy) is closed source, so it can't be rebuilt. If it crashes on your CPU, the installer runs the official binary through QEMU, which provides the missing instructions in software. It's slower than native, and it keeps working after Antigravity updates itself.
  • Everything goes into ~/.local/bin and ~/.local/share/legacy-cpu-agents; nothing needs sudo except installing QEMU for agy. On Arch, if pacman's package list is out of date, that runs a full pacman -Syu.

In Ulmaria

The Ulmaria installer offers these builds on processors without SSE4.2 ("AI coding agents for this processor" on its Extras page). It installs Bun, opencode and Cline to /opt/legacy-cpu-agents from the releases named in its pins-agents.env, each checked against a SHA-256, and its ulmaria-check starts each one. Antigravity is not included: its download cannot be pinned to a checked version.

Rebuilding for a new upstream release

Run the workflows in order from the Actions tab with the new versions: 1. WebKit (Bun version) → 2. Bun (Bun version) → 3. Apps (Bun, opencode and Cline versions) → 6. Whole system.

  • 1. WebKit is only needed when the Bun release pins a new WebKit commit (1.4.5 uses the same one as 1.4.4).
  • GitHub's "latest release" of opencode points at the 1.x line; look at the release list for the newest 2.x.
  • oven-sh deletes old toolchain images from ghcr.io. 2. Bun then uses this repo's copy (ghcr.io/ulmaria/legacy-cpu-agents-toolchain), or builds the base stage of oven-sh/WebKit's Dockerfile at the pinned commit and keeps a copy.
  • To use new builds in Ulmaria, copy their tags and checksums into the installer's pins-agents.env.

Changes

2026-11-28

  • Moved from abderrahmane-harouat/legacy-cpu-agents to the Ulmaria organization (the old address redirects).
  • Bun 1.4.4 → 1.4.5, Cline CLI 3.0.73 → 3.0.76, opencode 1.19.4 → 1.19.6 and, new, opencode 2.4.2. The Bun and Cline patches applied unchanged.
  • 3. Apps builds opencode 2.x, scans its prebuilt native parts and runs opencode-pty on the emulated CPUs.
  • 2. Bun no longer depends on oven-sh's toolchain image still existing.
  • Cline: its Bun license notices are regenerated for the Bun it is built with.
  • install.sh downloads everything at the same time, lists the releases once, and uses GITHUB_TOKEN when set.
  • New workflows 5. Installer and 6. Whole system, and ci/vm-tests.sh.
  • Ulmaria's installer offers these builds on old processors.

Still open

  • Not yet run on a real old PC since this update; the start-up time limits above are unproven there.
  • Bun's own JIT stress fixtures (scripts/verify-baseline.ts --jit-stress) are not run under the emulator yet.
  • A second, independent check with Intel SDE's chip-check mode (-mrm) is not set up.
  • opencode 2.x's prebuilt native parts are trusted to dispatch at run time; they are tested, not rebuilt.

License

The scripts, workflows and docs in this repo are MIT. Each file in patches/ modifies an upstream project and is under that project's license (WebKit: BSD/LGPL, Bun: MIT, Cline: Apache-2.0), and so are the binaries the workflows build.

About

Fix "Illegal instruction (core dumped)": opencode 2.x, Cline CLI and Bun rebuilt for old x86-64 CPUs without SSE4.2/AVX (Core 2 Duo, Pentium Dual-Core, Celeron, Athlon 64, Phenom II) on Linux

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages