Skip to content

Commit f249b92

Browse files
authored
Restore GraalVM image support for older CPUs (#4150)
1 parent 759a69d commit f249b92

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

.github/scripts/verify_old_cpus.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# Verifies that the native launcher runs on older x86_64 CPUs (without AVX/AVX2/FMA).
5+
# Uses QEMU user-mode emulation with a Westmere CPU model (2010, SSE4.2 but no AVX).
6+
7+
LAUNCHER_GZ="${1:?Usage: $0 <launcher.gz>}"
8+
9+
sudo apt-get update -qq && sudo apt-get install -y -qq qemu-user > /dev/null
10+
11+
LAUNCHER="/tmp/scala-cli-compat-test"
12+
gunzip -c "$LAUNCHER_GZ" > "$LAUNCHER"
13+
chmod +x "$LAUNCHER"
14+
15+
echo "Running native launcher under QEMU with Westmere CPU (no AVX/AVX2/FMA)..."
16+
qemu-x86_64 -cpu Westmere "$LAUNCHER" version
17+
echo "CPU compatibility check passed."

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ jobs:
269269
run: .github/scripts/generate-os-packages.sh
270270
- name: Copy artifacts
271271
run: ./mill -i copyDefaultLauncher --directory artifacts/
272+
- name: Verify native launcher CPU compatibility
273+
run: .github/scripts/verify_old_cpus.sh artifacts/scala-cli-x86_64-pc-linux.gz
272274
- uses: actions/upload-artifact@v6
273275
with:
274276
name: linux-launchers

project/settings/package.mill

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ trait CliLaunchers extends SbtModule { self =>
172172
else staticLibDir().path.toString
173173
super.nativeImageOptions() ++ Seq(
174174
"--no-fallback",
175+
"-march=compatibility",
175176
s"-H:IncludeResources=$localRepoResourcePath",
176177
s"-H:IncludeResources=$launcherTypeResourcePath",
177178
s"-H:IncludeResources=$defaultFilesResourcePath/.*",

0 commit comments

Comments
 (0)