Skip to content

Soul-driven AI agent with permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI, Telegram or More.

fix(release): baseline (no-AVX2) builds for Linux/Windows x64; installers pick them automatically (#155, 1.3.4)

Salman Qureshi648ec4547f0d
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d8fad2ba..1a43267d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -286,9 +286,17 @@ jobs:
echo "mercury stub: $*"
STUB
chmod +x "$rel/mercury-linux-x64"
+ # The no-AVX2 build (#155): the installer must pick it from /proc/cpuinfo
+ # or after an illegal-instruction crash of the default build.
+ cat > "$rel/mercury-linux-x64-baseline" <<'STUB'
+ #!/bin/sh
+ if [ "${1:-}" = "--version" ]; then echo "9.9.9-baseline"; exit 0; fi
+ echo "mercury baseline stub: $*"
+ STUB
+ chmod +x "$rel/mercury-linux-x64-baseline"
echo '<!doctype html><title>stub dashboard</title>' > "$rel/web/index.html"
tar -C "$rel" -czf "$rel/web.tar.gz" web
- (cd "$rel" && sha256sum mercury-linux-x64 web.tar.gz > checksums.txt)
+ (cd "$rel" && sha256sum mercury-linux-x64 mercury-linux-x64-baseline web.tar.gz > checksums.txt)
cat "$rel/checksums.txt"
echo "REL_ROOT=$RUNNER_TEMP/fake-release" >> "$GITHUB_ENV"
@@ -332,6 +340,41 @@ jobs:
test -x "$MERCURY_INSTALL/bin/mercury-dev"
[ "$("$MERCURY_INSTALL/bin/mercury-dev" --version)" = "9.9.9" ]
+ - name: The baseline build is chosen when /proc/cpuinfo has no avx2 (#155)
+ env:
+ MERCURY_VERSION: 9.9.9
+ MERCURY_DOWNLOAD_BASE: http://127.0.0.1:8765
+ MERCURY_INSTALL: ${{ runner.temp }}/mercury-baseline
+ MERCURY_NO_PATH: '1'
+ MERCURY_CPUINFO: ${{ runner.temp }}/cpuinfo-noavx2
+ run: |
+ set -euo pipefail
+ printf 'flags\t\t: fpu sse sse2 ssse3 sse4_1 sse4_2 avx\n' > "$RUNNER_TEMP/cpuinfo-noavx2"
+ sh scripts/install.sh 2>&1 | tee "$RUNNER_TEMP/install-baseline.log"
+ grep -q 'no AVX2' "$RUNNER_TEMP/install-baseline.log"
+ grep -q 'Smoke test passed' "$RUNNER_TEMP/install-baseline.log"
+ [ "$("$MERCURY_INSTALL/bin/mercury" --version)" = "9.9.9-baseline" ]
+
+ - name: An illegal-instruction crash of the default build falls back to baseline (#155)
+ env:
+ MERCURY_VERSION: 9.9.9
+ MERCURY_DOWNLOAD_BASE: http://127.0.0.1:8765
+ MERCURY_INSTALL: ${{ runner.temp }}/mercury-sigill
+ MERCURY_NO_PATH: '1'
+ run: |
+ set -euo pipefail
+ # The runner has AVX2, so cpuinfo says "default build" — which then dies with SIGILL.
+ cat > "$REL_ROOT/v9.9.9/mercury-linux-x64" <<'STUB'
+ #!/bin/sh
+ kill -ILL $$
+ STUB
+ chmod +x "$REL_ROOT/v9.9.9/mercury-linux-x64"
+ (cd "$REL_ROOT/v9.9.9" && sha256sum mercury-linux-x64 mercury-linux-x64-baseline web.tar.gz > checksums.txt)
+ sh scripts/install.sh 2>&1 | tee "$RUNNER_TEMP/install-sigill.log"
+ grep -q 'switching to the baseline build' "$RUNNER_TEMP/install-sigill.log"
+ grep -q 'Smoke test passed' "$RUNNER_TEMP/install-sigill.log"
+ [ "$("$MERCURY_INSTALL/bin/mercury" --version)" = "9.9.9-baseline" ]
+
- name: A tampered checksum must abort the install
env:
MERCURY_VERSION: 9.9.9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4b7249f6..a4006dba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## 1.3.4 — hotfix: binaries for CPUs without AVX2 (#155)
+
+- **"Illegal instruction (core dumped)" on older x86-64.** Bun's default x64 build uses AVX2; Intel CPUs before Haswell (2013) and some VMs crash at start. Releases now also ship **`mercury-linux-x64-baseline`** and **`mercury-win-x64-baseline.exe`**. The installers pick the baseline build when `/proc/cpuinfo` has no `avx2`, and switch to it automatically if the default build dies with an illegal instruction during the post-install smoke test. `MERCURY_ASSET=<asset name>` forces a build.
+
## 1.3.3 — hotfix: bots always get a provider that works
- **A bot never fails on a provider that cannot answer.** A new bot (from Telegram, the TUI or the web) runs on the default LLM; if the configured default has no key or its key is rejected (401), Mercury uses the first usable provider instead, and a provider that rejects its key is remembered and skipped — for bots, the main agent's fallback chain and the default — until the key is changed. A bot turn that hit a bad key now retries on another provider instead of dead-lettering.
diff --git a/README.md b/README.md
index 80ca894b..4641b555 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@
</p>
<p align="center">
- <strong>🔖 Current Stable: v1.3.3 — Steady Mercury</strong>
+ <strong>🔖 Current Stable: v1.3.4 — Steady Mercury</strong>
</p>
<p align="center">
diff --git a/docs/install.ps1 b/docs/install.ps1
index 81171de1..7df9f590 100644
--- a/docs/install.ps1
+++ b/docs/install.ps1
@@ -149,6 +149,8 @@ if ($arch -ne 'x64') {
}
$asset = "mercury-win-x64.exe"
+# MERCURY_ASSET forces a build (support use); mercury-win-x64-baseline.exe runs on CPUs without AVX2.
+if ($env:MERCURY_ASSET) { $asset = $env:MERCURY_ASSET }
$url = "$releaseDir/$asset"
$prefix = $env:MERCURY_INSTALL
@@ -201,8 +203,31 @@ try {
}
New-Item -ItemType Directory -Force -Path $binDir | Out-Null
- # Windows cannot overwrite a running executable; surface that error.
- if (Test-Path $binPath) { Remove-Item $binPath -Force }
+ # Windows cannot overwrite a running executable. `mercury upgrade` hands
+ # us its own PID in MERCURY_WAIT_PID: wait for it to exit (not a fixed
+ # sleep). Then wait for any other process still running the old binary
+ # (a daemon that has not finished its graceful shutdown yet).
+ if ($env:MERCURY_WAIT_PID) {
+ $waitPid = 0
+ if ([int]::TryParse($env:MERCURY_WAIT_PID, [ref]$waitPid) -and $waitPid -gt 0) {
+ Write-Info "Waiting for Mercury (PID $waitPid) to exit..."
+ Wait-Process -Id $waitPid -Timeout 60 -ErrorAction SilentlyContinue
+ }
+ }
+ if (Test-Path $binPath) {
+ $holders = @(Get-Process -ErrorAction SilentlyContinue | Where-Object {
+ try { $_.Path -and ([IO.Path]::GetFullPath($_.Path) -ieq [IO.Path]::GetFullPath($binPath)) } catch { $false }
+ })
+ if ($holders.Count -gt 0) {
+ Write-Info ("Waiting for running Mercury (PID {0}) to exit..." -f ($holders.Id -join ', '))
+ $holders | Wait-Process -Timeout 30 -ErrorAction SilentlyContinue
+ $still = @($holders | Where-Object { -not $_.HasExited })
+ if ($still.Count -gt 0) {
+ Die ("Mercury is still running (PID {0}). Run `mercury stop` and re-run the installer." -f ($still.Id -join ', '))
+ }
+ }
+ Remove-Item $binPath -Force
+ }
Move-Item -Path $binaryTmp -Destination $binPath -Force
$webDir = Join-Path $binDir 'web'
if (Test-Path $webDir) { Remove-Item $webDir -Recurse -Force }
@@ -215,6 +240,33 @@ finally {
Write-Info "Installed to $binPath"
+# Post-install smoke. A CPU without AVX2 cannot run the default build and
+# dies with STATUS_ILLEGAL_INSTRUCTION (0xC000001D, #155): switch to the
+# baseline build in place.
+$smoke = & $binPath --version 2>&1
+$smokeExit = $LASTEXITCODE
+if ($smokeExit -ne 0 -and $asset -ne 'mercury-win-x64-baseline.exe' -and ($smokeExit -eq -1073741795 -or $smokeExit -eq 3221225501)) {
+ Write-Info 'This CPU cannot run the default build (illegal instruction) - switching to the baseline build'
+ $asset = 'mercury-win-x64-baseline.exe'
+ $tmp2 = Join-Path $env:TEMP ("mercury-" + [guid]::NewGuid().ToString('N'))
+ New-Item -ItemType Directory -Path $tmp2 | Out-Null
+ try {
+ $expected = Get-RequiredChecksum -Checksums $checksums -Asset $asset
+ $dl = Join-Path $tmp2 $asset
+ Save-VerifiedAsset -Uri "$releaseDir/$asset" -Path $dl -ExpectedHash $expected -Asset $asset
+ Remove-Item $binPath -Force
+ Move-Item -Path $dl -Destination $binPath -Force
+ $smoke = & $binPath --version 2>&1
+ $smokeExit = $LASTEXITCODE
+ } finally {
+ Remove-Item $tmp2 -Recurse -Force -ErrorAction SilentlyContinue
+ }
+}
+if ($smokeExit -ne 0) {
+ Die "Mercury $versionLabel is installed but not runnable on this machine: $smoke (please report this at https://github.com/$Repo/issues)"
+}
+Write-Info "Smoke test passed: $binName --version -> $smoke"
+
$pathUpdated = Update-UserPath -BinDir $binDir
Write-Host ''
diff --git a/docs/install.sh b/docs/install.sh
old mode 100644
new mode 100755
index bec544ad..58227cc8
--- a/docs/install.sh
+++ b/docs/install.sh
@@ -15,13 +15,32 @@
# The binary lands at $MERCURY_INSTALL/bin/mercury.
# (mercury-dev on the dev channel.)
# MERCURY_NO_PATH If set to "1", skip modifying shell rc files.
+# MERCURY_DOWNLOAD_BASE
+# Base URL the release assets are fetched from. Default:
+# https://github.com/<repo>/releases/download — the
+# installer appends /v<version>/ (or the dev tag). Used by
+# CI to run this script against a local release directory.
#
# Windows users: use install.ps1 instead.
set -eu
REPO="cosmicstack-labs/mercury-agent"
-GITHUB_DL="https://github.com/${REPO}/releases/download"
+GITHUB_DL="${MERCURY_DOWNLOAD_BASE:-https://github.com/${REPO}/releases/download}"
+
+# ----- helpers ---------------------------------------------------------------
+
+c_red() { printf '\033[31m%s\033[0m' "$1"; }
+c_green() { printf '\033[32m%s\033[0m' "$1"; }
+c_yellow() { printf '\033[33m%s\033[0m' "$1"; }
+c_bold() { printf '\033[1m%s\033[0m' "$1"; }
+
+info() { printf '%s %s\n' "$(c_green '→')" "$1"; }
+warn() { printf '%s %s\n' "$(c_yellow '!')" "$1" >&2; }
+err() { printf '%s %s\n' "$(c_red 'x')" "$1" >&2; }
+die() { err "$1"; exit 1; }
+
+have() { command -v "$1" >/dev/null 2>&1; }
# ----- channel ---------------------------------------------------------------
#
@@ -50,20 +69,6 @@ case "$CHANNEL" in
;;
esac
-# ----- helpers ---------------------------------------------------------------
-
-c_red() { printf '\033[31m%s\033[0m' "$1"; }
-c_green() { printf '\033[32m%s\033[0m' "$1"; }
-c_yellow() { printf '\033[33m%s\033[0m' "$1"; }
-c_bold() { printf '\033[1m%s\033[0m' "$1"; }
-
-info() { printf '%s %s\n' "$(c_green '→')" "$1"; }
-warn() { printf '%s %s\n' "$(c_yellow '!')" "$1" >&2; }
-err() { printf '%s %s\n' "$(c_red 'x')" "$1" >&2; }
-die() { err "$1"; exit 1; }
-
-have() { command -v "$1" >/dev/null 2>&1; }
-
# Detect OS in Mercury's release naming (macos | linux).
detect_os() {
uname_s=$(uname -s 2>/dev/null || echo unknown)
@@ -76,6 +81,20 @@ detect_os() {
esac
}
+# Linux x64 only: Bun's default x64 build uses AVX2. CPUs without it (Intel
+# before Haswell/2013, some VMs) crash with "Illegal instruction" (#155) —
+# the baseline build runs on any x86-64. MERCURY_CPUINFO exists for tests.
+cpu_has_avx2() {
+ cpuinfo=${MERCURY_CPUINFO:-/proc/cpuinfo}
+ [ -r "$cpuinfo" ] || return 0 # unknown → assume a modern CPU
+ grep -q -w avx2 "$cpuinfo"
+}
+
+# True when checksums.txt lists the asset (older releases have no baseline build).
+has_asset() {
+ awk -v a="$2" '$2 == a { found=1 } END { exit found ? 0 : 1 }' "$1"
+}
+
# Detect arch in Mercury's release naming (arm64 | x64). We don't ship 32-bit.
detect_arch() {
uname_m=$(uname -m 2>/dev/null || echo unknown)
@@ -172,10 +191,13 @@ maybe_update_path() {
fi
mkdir -p "$(dirname "$rc")"
+ # The literal `$PATH` must land in the rc file unexpanded (SC2016 is the point).
case "$rc" in
*config.fish)
+ # shellcheck disable=SC2016
printf '\n%s\nset -gx PATH %s $PATH\n' "$marker" "$bin_dir" >> "$rc" ;;
*)
+ # shellcheck disable=SC2016
printf '\n%s\nexport PATH="%s:$PATH"\n' "$marker" "$bin_dir" >> "$rc" ;;
esac
info "Added $bin_dir to PATH in $(basename "$rc")"
@@ -210,7 +232,6 @@ Install the supported Node.js package instead:
release_dir="${GITHUB_DL}/${RELEASE_TAG}"
version_label="dev (rolling ${RELEASE_TAG})"
else
- release_dir="${GITHUB_DL}/v${version}"
if [ -z "$version" ]; then
info "Resolving latest version from GitHub..."
version=$(resolve_latest_version)
@@ -237,6 +258,15 @@ Install the supported Node.js package instead:
checksum_url="${release_dir}/checksums.txt"
info "Downloading checksums.txt ..."
fetch_to "$checksum_url" "$checksums_tmp" || die "Failed to download required checksums from $checksum_url"
+ # Pick the build this CPU can run. MERCURY_ASSET forces one (support use).
+ if [ -n "${MERCURY_ASSET:-}" ]; then
+ asset="$MERCURY_ASSET"
+ elif [ "$os" = "linux" ] && [ "$arch" = "x64" ] && ! cpu_has_avx2 && has_asset "$checksums_tmp" "mercury-linux-x64-baseline"; then
+ info "This CPU has no AVX2 — using the baseline build"
+ asset="mercury-linux-x64-baseline"
+ fi
+ url="${release_dir}/${asset}"
+ binary_tmp="$tmp_dir/$asset"
expected_binary=$(checksum_for "$checksums_tmp" "$asset")
expected_web=$(checksum_for "$checksums_tmp" "web.tar.gz")
@@ -288,6 +318,31 @@ Install the supported Node.js package instead:
info "Installed to $bin_path"
+ # Post-install smoke: the binary must at least report its version. A
+ # wrong-arch download, a glibc mismatch or a quarantined binary fails
+ # here with a readable message instead of at first use.
+ smoke_out=$("$bin_path" --version 2>&1); smoke_status=$?
+ # SIGILL (exit 132) on the default build = a CPU without AVX2 that
+ # /proc/cpuinfo did not reveal: switch to the baseline build in place.
+ if [ "$smoke_status" -ne 0 ] && [ "$os" = "linux" ] && [ "$arch" = "x64" ] && [ "$asset" != "mercury-linux-x64-baseline" ] \
+ && { [ "$smoke_status" -eq 132 ] || printf '%s' "$smoke_out" | grep -qi 'illegal instruction'; } \
+ && has_asset "$checksums_tmp" "mercury-linux-x64-baseline"; then
+ info "This CPU cannot run the default build (illegal instruction) — switching to the baseline build"
+ asset="mercury-linux-x64-baseline"
+ fetch_to "${release_dir}/${asset}" "$tmp_dir/$asset" || die "Failed to download ${release_dir}/${asset}"
+ [ "$(sha256_file "$tmp_dir/$asset")" = "$(checksum_for "$checksums_tmp" "$asset")" ] || die "Checksum mismatch for $asset"
+ mv "$tmp_dir/$asset" "$bin_path"
+ chmod +x "$bin_path"
+ smoke_out=$("$bin_path" --version 2>&1); smoke_status=$?
+ fi
+ if [ "$smoke_status" -eq 0 ]; then
+ info "Smoke test passed: $BIN_NAME --version → $smoke_out"
+ else
+ err "The installed binary failed to run: $bin_path --version"
+ printf '%s\n' "$smoke_out" | sed 's/^/ /' >&2
+ die "Mercury ${version_label} is installed but not runnable on ${os}-${arch}. Please report this at https://github.com/${REPO}/issues (include the lines above)."
+ fi
+
rm -rf "$tmp_dir"
trap - EXIT INT TERM
@@ -301,10 +356,14 @@ Install the supported Node.js package instead:
printf ' source %s\n\n' "$(shell_rc_file)"
fi
+ if [ "${PATH_UPDATED:-0}" = "1" ]; then
+ launch_hint="$BIN_NAME"
+ else
+ launch_hint="$bin_path"
+ fi
printf 'Get started:\n'
printf ' %s --help\n' "$bin_path"
- printf ' %s # first run launches setup wizard\n\n' \
- "$([ "${PATH_UPDATED:-0}" = "1" ] && echo "$BIN_NAME" || echo "$bin_path")"
+ printf ' %s # first run launches setup wizard\n\n' "$launch_hint"
if [ "$CHANNEL" = "dev" ]; then
printf '%s Dev channel — preview builds, may break. Run to check:\n' "$(c_yellow 'NOTE:')"
diff --git a/package-lock.json b/package-lock.json
index da6aa3a4..1e226a1e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@cosmicstack/mercury-agent",
- "version": "1.3.3",
+ "version": "1.3.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@cosmicstack/mercury-agent",
- "version": "1.3.3",
+ "version": "1.3.4",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
diff --git a/package.json b/package.json
index 001fc480..7034f0ad 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@cosmicstack/mercury-agent",
- "version": "1.3.3",
+ "version": "1.3.4",
"description": "Soul-driven AI agent with Second Brain memory, permission-hardened tools, token budgets, and multi-channel access. Runs 24/7 from CLI or Telegram.",
"type": "module",
"main": "dist/index.js",
diff --git a/scripts/build-bin.cjs b/scripts/build-bin.cjs
index 4a86b038..664471c4 100644
--- a/scripts/build-bin.cjs
+++ b/scripts/build-bin.cjs
@@ -82,8 +82,13 @@ const ALL_TARGETS = [
{ id: 'bun-darwin-arm64', out: 'mercury-macos-arm64' },
{ id: 'bun-darwin-x64', out: 'mercury-macos-x64' },
{ id: 'bun-linux-x64', out: 'mercury-linux-x64' },
+ // Bun's x64 targets emit AVX2; CPUs without it (pre-2013 Intel, some VMs)
+ // die with "Illegal instruction" (#155). The baseline builds run anywhere;
+ // the installers pick them when the CPU lacks avx2 or the default crashes.
+ { id: 'bun-linux-x64-baseline', out: 'mercury-linux-x64-baseline' },
{ id: 'bun-linux-arm64', out: 'mercury-linux-arm64' },
{ id: 'bun-windows-x64', out: 'mercury-win-x64.exe' },
+ { id: 'bun-windows-x64-baseline', out: 'mercury-win-x64-baseline.exe' },
];
function hostTarget() {
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index 3f2c31f5..7df9f590 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -149,6 +149,8 @@ if ($arch -ne 'x64') {
}
$asset = "mercury-win-x64.exe"
+# MERCURY_ASSET forces a build (support use); mercury-win-x64-baseline.exe runs on CPUs without AVX2.
+if ($env:MERCURY_ASSET) { $asset = $env:MERCURY_ASSET }
$url = "$releaseDir/$asset"
$prefix = $env:MERCURY_INSTALL
@@ -238,6 +240,33 @@ finally {
Write-Info "Installed to $binPath"
+# Post-install smoke. A CPU without AVX2 cannot run the default build and
+# dies with STATUS_ILLEGAL_INSTRUCTION (0xC000001D, #155): switch to the
+# baseline build in place.
+$smoke = & $binPath --version 2>&1
+$smokeExit = $LASTEXITCODE
+if ($smokeExit -ne 0 -and $asset -ne 'mercury-win-x64-baseline.exe' -and ($smokeExit -eq -1073741795 -or $smokeExit -eq 3221225501)) {
+ Write-Info 'This CPU cannot run the default build (illegal instruction) - switching to the baseline build'
+ $asset = 'mercury-win-x64-baseline.exe'
+ $tmp2 = Join-Path $env:TEMP ("mercury-" + [guid]::NewGuid().ToString('N'))
+ New-Item -ItemType Directory -Path $tmp2 | Out-Null
+ try {
+ $expected = Get-RequiredChecksum -Checksums $checksums -Asset $asset
+ $dl = Join-Path $tmp2 $asset
+ Save-VerifiedAsset -Uri "$releaseDir/$asset" -Path $dl -ExpectedHash $expected -Asset $asset
+ Remove-Item $binPath -Force
+ Move-Item -Path $dl -Destination $binPath -Force
+ $smoke = & $binPath --version 2>&1
+ $smokeExit = $LASTEXITCODE
+ } finally {
+ Remove-Item $tmp2 -Recurse -Force -ErrorAction SilentlyContinue
+ }
+}
+if ($smokeExit -ne 0) {
+ Die "Mercury $versionLabel is installed but not runnable on this machine: $smoke (please report this at https://github.com/$Repo/issues)"
+}
+Write-Info "Smoke test passed: $binName --version -> $smoke"
+
$pathUpdated = Update-UserPath -BinDir $binDir
Write-Host ''
diff --git a/scripts/install.sh b/scripts/install.sh
index fe12c884..58227cc8 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -81,6 +81,20 @@ detect_os() {
esac
}
+# Linux x64 only: Bun's default x64 build uses AVX2. CPUs without it (Intel
+# before Haswell/2013, some VMs) crash with "Illegal instruction" (#155) —
+# the baseline build runs on any x86-64. MERCURY_CPUINFO exists for tests.
+cpu_has_avx2() {
+ cpuinfo=${MERCURY_CPUINFO:-/proc/cpuinfo}
+ [ -r "$cpuinfo" ] || return 0 # unknown → assume a modern CPU
+ grep -q -w avx2 "$cpuinfo"
+}
+
+# True when checksums.txt lists the asset (older releases have no baseline build).
+has_asset() {
+ awk -v a="$2" '$2 == a { found=1 } END { exit found ? 0 : 1 }' "$1"
+}
+
# Detect arch in Mercury's release naming (arm64 | x64). We don't ship 32-bit.
detect_arch() {
uname_m=$(uname -m 2>/dev/null || echo unknown)
@@ -244,6 +258,15 @@ Install the supported Node.js package instead:
checksum_url="${release_dir}/checksums.txt"
info "Downloading checksums.txt ..."
fetch_to "$checksum_url" "$checksums_tmp" || die "Failed to download required checksums from $checksum_url"
+ # Pick the build this CPU can run. MERCURY_ASSET forces one (support use).
+ if [ -n "${MERCURY_ASSET:-}" ]; then
+ asset="$MERCURY_ASSET"
+ elif [ "$os" = "linux" ] && [ "$arch" = "x64" ] && ! cpu_has_avx2 && has_asset "$checksums_tmp" "mercury-linux-x64-baseline"; then
+ info "This CPU has no AVX2 — using the baseline build"
+ asset="mercury-linux-x64-baseline"
+ fi
+ url="${release_dir}/${asset}"
+ binary_tmp="$tmp_dir/$asset"
expected_binary=$(checksum_for "$checksums_tmp" "$asset")
expected_web=$(checksum_for "$checksums_tmp" "web.tar.gz")
@@ -298,7 +321,21 @@ Install the supported Node.js package instead:
# Post-install smoke: the binary must at least report its version. A
# wrong-arch download, a glibc mismatch or a quarantined binary fails
# here with a readable message instead of at first use.
- if smoke_out=$("$bin_path" --version 2>&1); then
+ smoke_out=$("$bin_path" --version 2>&1); smoke_status=$?
+ # SIGILL (exit 132) on the default build = a CPU without AVX2 that
+ # /proc/cpuinfo did not reveal: switch to the baseline build in place.
+ if [ "$smoke_status" -ne 0 ] && [ "$os" = "linux" ] && [ "$arch" = "x64" ] && [ "$asset" != "mercury-linux-x64-baseline" ] \
+ && { [ "$smoke_status" -eq 132 ] || printf '%s' "$smoke_out" | grep -qi 'illegal instruction'; } \
+ && has_asset "$checksums_tmp" "mercury-linux-x64-baseline"; then
+ info "This CPU cannot run the default build (illegal instruction) — switching to the baseline build"
+ asset="mercury-linux-x64-baseline"
+ fetch_to "${release_dir}/${asset}" "$tmp_dir/$asset" || die "Failed to download ${release_dir}/${asset}"
+ [ "$(sha256_file "$tmp_dir/$asset")" = "$(checksum_for "$checksums_tmp" "$asset")" ] || die "Checksum mismatch for $asset"
+ mv "$tmp_dir/$asset" "$bin_path"
+ chmod +x "$bin_path"
+ smoke_out=$("$bin_path" --version 2>&1); smoke_status=$?
+ fi
+ if [ "$smoke_status" -eq 0 ]; then
info "Smoke test passed: $BIN_NAME --version → $smoke_out"
else
err "The installed binary failed to run: $bin_path --version"
diff --git a/scripts/verify-standalone-release.cjs b/scripts/verify-standalone-release.cjs
index a9a8dcdd..a6ea0638 100644
--- a/scripts/verify-standalone-release.cjs
+++ b/scripts/verify-standalone-release.cjs
@@ -11,8 +11,10 @@ const assets = [
'mercury-macos-arm64',
'mercury-macos-x64',
'mercury-linux-x64',
+ 'mercury-linux-x64-baseline',
'mercury-linux-arm64',
'mercury-win-x64.exe',
+ 'mercury-win-x64-baseline.exe',
'web.tar.gz',
];
diff --git a/website/docs/getting-started/platforms/linux.mdx b/website/docs/getting-started/platforms/linux.mdx
index 6631ade6..b29880ff 100644
--- a/website/docs/getting-started/platforms/linux.mdx
+++ b/website/docs/getting-started/platforms/linux.mdx
@@ -21,6 +21,10 @@ exec $SHELL -l
mercury --version
```
+:::note Older x86-64 CPUs
+The default Linux x64 build uses AVX2. On a CPU without it (Intel before 2013, some VMs) the installer picks the **baseline** build automatically — from `/proc/cpuinfo`, or by switching after an `Illegal instruction` crash. To force it: `MERCURY_ASSET=mercury-linux-x64-baseline curl -fsSL https://mercuryagent.sh/install.sh | sh`.
+:::
+
## Via npm (if you already have Node)
```bash