Hi,
The install script is failing on older linux computers due to a dependency problem
Tried on several linux x86 computers:
user@k:/tmp/playground-cli$ curl -fsSL https://raw.githubusercontent.com/parity
tech/playground-cli/main/install.sh | bash
Installed playground (linux/x64) v0.44.0
playground is ready! Setting up dependencies…
bash: line 136: 664434 Illegal instruction "$INSTALL_DIR/bin/$CMD" login --yes
Dependency setup failed. Run playground login when ready.
l@770f86fbe31e:~$ curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | bash
Installed playground (linux/x64) v0.44.0
playground is ready! Setting up dependencies…
bash: line 136: 3628 Illegal instruction "$INSTALL_DIR/bin/$CMD" login --yes
Dependency setup failed. Run playground login when ready.
Bug: Linux x64 binary crashes with "Illegal instruction" on CPUs without AVX2
System: Linux x86_64
Playground CLI version: v0.45.0
Install command: curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | bash
Description
The prebuilt Linux x64 binary (playground) immediately crashes with Illegal instruction (signal SIGILL) when run on CPUs that do not support the AVX2 instruction set.
The install script succeeds, but fails at the post-install playground login --yes step:
Installed playground (linux/x64) v0.45.0
playground is ready! Setting up dependencies…
bash: line 136: 6843 Illegal instruction "$INSTALL_DIR/bin/$CMD" login --yes
Running any subcommand (e.g. playground --help) produces the same result:
Illegal instruction (core dumped)
Root cause
The prebuilt binary was compiled with target-cpu=native (or equivalent) on a CI runner with a Haswell-or-newer CPU, which enables AVX2 instructions as a baseline. CPUs older than Intel Haswell (2013) or AMD Excavator (2015) do not support AVX2 and will fault on the first such instruction.
$ objdump -d ~/.polkadot/bin/playground | grep -cE "vpmaddubsw|vpermq|vpgather"
1213
The CPU in question supports AVX1 but not AVX2:
$ grep -o "avx2" /proc/cpuinfo # returns nothing
$ grep -o "avx " /proc/cpuinfo # present
Reproduction
- Run the install on any x86_64 Linux machine with a pre-Haswell CPU (or a VM pinned to such a CPU model).
- Attempt to run
playground.
The error can also be shown with QEMU or by restricting CPU features via cpuid mask if no physical older CPU is available.
Expected behavior
The binary should run on any x86_64 CPU that meets the Linux x86_64 baseline (x86-64-v1 or at minimum x86-64-v2), or the project should publish multiple build variants.
Suggested fix
Two approaches, ideally both:
-
Publish a baseline build: Provide a playground-linux-x64-baseline (or similar) asset alongside the native one, compiled with RUSTFLAGS="-C target-cpu=x86-64" (or x86-64-v2). This ensures compatibility with older hardware.
-
Add runtime CPU feature detection: Check /proc/cpuinfo for avx2 before launching the binary, and fall back to a baseline binary or show a clear error message directing users to the correct variant.
Prior art
Many Rust/Go projects have encountered and solved this same problem:
Workaround for affected users
Building from source with the local toolchain works, since rustc detects the actual CPU capabilities:
git clone https://github.com/paritytech/playground-cli.git
cd playground-cli
pnpm install && pnpm build && pnpm cli:install
Environment
$ uname -m
x86_64
$ grep "model name" /proc/cpuinfo | head -1
# (varies by affected machine)
$ cat /proc/cpuinfo | grep flags | head -1 | grep -o "avx2"
# (empty = affected)
Hi,
The install script is failing on older linux computers due to a dependency problem
Tried on several linux x86 computers:
Bug: Linux x64 binary crashes with "Illegal instruction" on CPUs without AVX2
System: Linux x86_64
Playground CLI version: v0.45.0
Install command:
curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | bashDescription
The prebuilt Linux x64 binary (
playground) immediately crashes withIllegal instruction(signal SIGILL) when run on CPUs that do not support the AVX2 instruction set.The install script succeeds, but fails at the post-install
playground login --yesstep:Running any subcommand (e.g.
playground --help) produces the same result:Root cause
The prebuilt binary was compiled with
target-cpu=native(or equivalent) on a CI runner with a Haswell-or-newer CPU, which enables AVX2 instructions as a baseline. CPUs older than Intel Haswell (2013) or AMD Excavator (2015) do not support AVX2 and will fault on the first such instruction.The CPU in question supports AVX1 but not AVX2:
Reproduction
playground.The error can also be shown with QEMU or by restricting CPU features via
cpuidmask if no physical older CPU is available.Expected behavior
The binary should run on any x86_64 CPU that meets the Linux x86_64 baseline (x86-64-v1 or at minimum x86-64-v2), or the project should publish multiple build variants.
Suggested fix
Two approaches, ideally both:
Publish a baseline build: Provide a
playground-linux-x64-baseline(or similar) asset alongside the native one, compiled withRUSTFLAGS="-C target-cpu=x86-64"(orx86-64-v2). This ensures compatibility with older hardware.Add runtime CPU feature detection: Check
/proc/cpuinfoforavx2before launching the binary, and fall back to a baseline binary or show a clear error message directing users to the correct variant.Prior art
Many Rust/Go projects have encountered and solved this same problem:
rust-cryptolinux-x64-baselinevariantsWorkaround for affected users
Building from source with the local toolchain works, since
rustcdetects the actual CPU capabilities:Environment