fix(cmake): download baseline WebKit for x64 baseline builds#27007
fix(cmake): download baseline WebKit for x64 baseline builds#27007
Conversation
When ENABLE_BASELINE is set for x64 builds, Bun is compiled with -march=nehalem (no AVX/AVX2), but the prebuilt WebKit was downloaded without a -baseline suffix, linking against a WebKit compiled with AVX/AVX2 support. This caused SIGILL crashes on CPUs without AVX. Add -baseline suffix to the WebKit download URL when ENABLE_BASELINE is true for amd64 targets, matching the baseline artifact names from oven-sh/WebKit PR #137. Also remove unused WEBKIT_PREVIEW_PR variable (PR #140 was merged). Closes #27006 Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughModified WebKit CMake configuration to remove WEBKIT_PREVIEW_PR definition and introduce baseline build suffix handling. When ENABLE_BASELINE is enabled and WEBKIT_ARCH is amd64, the script appends -baseline to WEBKIT_SUFFIX in two locations, affecting artifact naming and download URLs for baseline builds. Changes
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. No actionable comments were generated in the recent review. 🎉 Comment |
Code ReviewNewest first ✅ 883ea — Looks good! Reviewed 1 file in Powered by Claude Code Review |
Summary
-baselinesuffix to WebKit download URL whenENABLE_BASELINEis set for x64 builds, so baseline Bun links against a WebKit compiled without AVX/AVX2 instructionsWEBKIT_PREVIEW_PRvariable (WebKit PR Error using custom npm registry in bunfig.toml #140 was already merged)Root cause
When
ENABLE_BASELINEis set, Bun's own code is compiled with-march=nehalem(SSE4.2 only, no AVX). However,SetupWebKit.cmakewas downloading the regular WebKit tarball (bun-webkit-linux-amd64.tar.gz) which is compiled with AVX/AVX2 support. When baseline Bun called into WebKit/JSC on a non-AVX CPU, it hit AVX instructions and crashed with SIGILL (exit code 132).Fix
The suffix computation now includes a check for
ENABLE_BASELINE:This produces the correct artifact names matching oven-sh/WebKit PR #137:
bun-webkit-linux-amd64-baseline.tar.gzbun-webkit-linux-amd64-baseline-lto.tar.gzbun-webkit-linux-amd64-musl-baseline.tar.gzbun-webkit-linux-amd64-musl-baseline-lto.tar.gzDependencies
This fix requires oven-sh/WebKit PR #137 to be merged first so that the baseline WebKit artifacts exist in releases. Until then, baseline CI builds will fail to download WebKit (which is the desired behavior - it's better to fail loudly at build time than to silently link AVX-enabled WebKit into a baseline binary).
Test plan
Bun.servewhen sending a file #137 is merged: verify baseline x64 build downloads and links against the correct WebKitBun.servewhen sending a file #137 is merged: verify baseline Bun runs without SIGILL on non-AVX CPUsCloses #27006
🤖 Generated with Claude Code