Skip to content

fix(ci): preserve baseline x86-64 Linux compatibility - #195

Merged
zouyonghe merged 1 commit into
mainfrom
codex/fix-linux-amd64-cpu-baseline
Nov 16, 2026
Merged

zouyonghe merged 1 commit into
mainfrom
codex/fix-linux-amd64-cpu-baseline

Conversation

@zouyonghe

@zouyonghe zouyonghe commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Problem

Linux amd64 release builds use ubuntu-latest, allowing a runner image migration to raise the effective CPU baseline without a source or dependency change. In the builds associated with #192, v4.29.3 used Ubuntu 24.04, while v4.29.4 used Ubuntu 26.04 and installed amd64v3 packages.

The official v4.29.4 shell contains unconditional BMI2 instructions in generic native ring routines such as fe_loose_invert; the corresponding v4.29.3 routine does not. Merely finding SIMD instructions anywhere in the executable would not establish this problem, since runtime-dispatched optimized routines are legitimate. Rust flags alone also cannot constrain code compiled by the native C compiler.

Changes

  • Pin the Linux amd64 release runner to ubuntu-24.04, keeping the compiler and system library environment on the compatible baseline.
  • Set target-specific Cargo Rust flags to -C target-cpu=x86-64 and native C/C++ flags to -march=x86-64 -mtune=generic for x86_64-unknown-linux-gnu throughout the Linux build job. Other target architectures and platform jobs keep their existing configuration.
  • Add release workflow regression coverage, including real C and C++ preprocessor probes that first enable an x86-64-v3 control and then verify that the workflow flags disable AVX/AVX2, BMI/BMI2, FMA and other above-baseline features while retaining SSE2. The probe runs on Linux x64 and macOS with an explicit Linux x86_64 target.

Validation

  • Confirmed both new regressions fail against the previous workflow: floating runner selection and advanced native CPU features remain enabled.
  • node --test scripts/ci/build-desktop-tauri-workflow.test.mjs: 12 passed.
  • pnpm run test:prepare-resources: 221 passed.
  • python3 -m unittest discover -s scripts/ci -p 'test_*.py': 95 passed.
  • Syntax checks: all 43 Node scripts and Python scripts passed.
  • git diff --check: passed.
  • Independent review found no blocking issues.

Final Linux installer generation and GUI startup on an Ivy Bridge CPU or equivalent emulator have not been exercised in this change. The compiler probes verify the effective native compilation baseline, not every instruction or dynamic dependency in a final release. Keep #192 open until a newly built artifact is validated on the affected class of machine.

Refs #192.

Summary by Sourcery

Preserve pre-AVX Linux amd64 release compatibility by pinning the build environment and enforcing an x86-64 CPU baseline.

Bug Fixes:

  • Preserve baseline x86-64 compatibility for Linux amd64 release builds by stabilizing the runner and constraining Rust and native compiler CPU targets.

CI:

  • Add regression coverage to verify stable Linux amd64 runner selection, target-scoped flags, and suppression of above-baseline native CPU features without changing ARM settings.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/build-desktop-tauri.yml" line_range="171" />
<code_context>
+    env:
+      # Keep both Rust and native dependencies compatible with pre-AVX CPUs.
+      # Target-scoped flags leave the arm64 build unchanged.
+      CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS: '-C target-cpu=x86-64'
+      CFLAGS_x86_64_unknown_linux_gnu: '-march=x86-64 -mtune=generic'
+      CXXFLAGS_x86_64_unknown_linux_gnu: '-march=x86-64 -mtune=generic'
</code_context>
<issue_to_address>
**Rust builds miss CPU baseline**

When the Linux build runs with its current targetless Tauri command, cargo does not apply target-specific Rust flags to host builds when no `--target` is specified, so the Tauri build compiles Rust crates without this explicit baseline constraint; a dependency that emits above-baseline instructions then remains incompatible with pre-AVX CPUs.

Pass `--target x86_64-unknown-linux-gnu` to the amd64 Tauri build, or apply `RUSTFLAGS` conditionally to the amd64 matrix entry and test the effective Rust compilation flags.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 1 finding to address first, and these settings change the CPU instructions and native-library baseline used in Linux x86-64 release artifacts. If the resulting binaries regress on supported machines, reverting will fix future builds, but already published artifacts would need to be replaced with a corrected release.

Blocking findings: .github/workflows/build-desktop-tauri.yml:171


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@zouyonghe

Copy link
Copy Markdown
Member Author

@sourcery-ai review

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@zouyonghe
zouyonghe merged commit 807c5eb into main Nov 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant