paritytech / paritytech/playground-cli

breaking linux x86 and 64 builds due to old cpu's without the avx2

Open
#433 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5
Forks
12
PR merge metrics
No merged PRs in 30d

Description

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
  1. Run the install on any x86_64 Linux machine with a pre-Haswell CPU (or a VM pinned to such a CPU model).
  2. 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:

  1. 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.

  2. 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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with install.sh and the post-install playground login --yes entry point; reproduce the failure on a pre-Haswell or AVX2-disabled Linux x86_64 environment. Compare the published binary's CPU requirements with the stated Linux x86-64 baseline, and consider the issue done when the install flow runs successfully or gives a clear fallback/error, verified with playground --help.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust, shell
Domain
build-system, cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.