Skip to content

release: strip symbols in the release profile (#193) - #228

Merged
caomengxuan666 merged 1 commit into
masterfrom
ci/strip-release
Oct 9, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
ci/strip-release

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Fixes #193.

Change

Add strip = "symbols" to [profile.release] in Cargo.toml. Cargo strips the symbol table at link time on every target the release pipeline builds (x86_64/aarch64-pc-windows-msvc, x86_64/aarch64-unknown-linux-gnu, aarch64/x86_64-apple-darwin), so no per-platform strip step is needed in release.yml. Supported since Rust 1.59; the repo already requires 1.70.

Why size correlates with static linking (issue item 2)

  • Windows legs build with RUSTFLAGS="-C target-feature=+crt-static" (release.yml): the CRT is statically linked and Rust std + all crates are embedded into one self-contained .exe — that is why the Windows binary is the largest artifact. Debug info goes to a side-by-side .pdb that is not shipped, so the shipped .exe is already symbol-light; strip is a near-no-op there (verified locally, below).
  • Linux legs link the system glibc dynamically (documented floor: glibc 2.35, ubuntu-22.04 build image) — smaller binaries that depend on system libc/libm/libgcc_s, but Rust std and all crate code are still statically linked into the binary. The v1.3.3 Linux ELF shipped not stripped with a full symbol table (~12 MB; ~11 MB after strip, matching the issue's measurements).
  • macOS legs are in the same boat as Linux (dynamically linked against system libSystem, full symbol table shipped).
  • Published assets stay small because .tar.gz/.zip compress the embedded-std binary well (v1.3.3 linux-x86_64 tarball: 4.83 MB compressed from a ~12 MB binary). Stripping removes ~1 MB pre-compression, which also shrinks the compressed asset and any future self-update download.
  • Per [question/perf] release binary 未 strip (12M),且体积与静态编译相关性说明 #193's suggestion this keeps dynamic glibc as the default (no musl leg added); a x86_64-unknown-linux-musl static asset remains a possible follow-up.

Size table

Target Binary Before (v1.3.3) After (expected) Source
x86_64-pc-windows-msvc niu.exe 10,469,888 B (9.98 MiB) 10,470,912 B (9.98 MiB, ±0.01%) — no-op, debug info in .pdb measured locally, both builds
aarch64-pc-windows-msvc niu.exe n/a locally same MSVC behavior — no-op 待 CI 验证
x86_64-unknown-linux-gnu niu (ELF) ~12 MB, not stripped (issue #193); local strip → ~11 MB ~11 MB stripped issue #193 measurement; post-strip tarball size 待 CI 验证
aarch64-unknown-linux-gnu niu (ELF) tarball 4,790,714 B (v1.3.3) slightly smaller asset size from v1.3.3 release; 待 CI 验证
aarch64-apple-darwin niu (Mach-O) tarball 4,277,909 B (v1.3.3) slightly smaller asset size from v1.3.3 release; 待 CI 验证
x86_64-apple-darwin niu (Mach-O) tarball 4,670,904 B (v1.3.3) slightly smaller asset size from v1.3.3 release; 待 CI 验证

Published compressed assets for reference (v1.3.3): linux-x86_64 .tar.gz 5,068,989 B, linux-aarch64 4,790,714 B, macos-aarch64 4,277,909 B, macos-x86_64 4,670,904 B, win-x64 .zip 7,589,339 B (bundles winuxcmd), win-x64 setup 7,068,339 B.

ci.yml size gate

ci.yml has no artifact-size check/threshold job today, so there is nothing to update there; if one is added later, the Windows MSVC numbers above must not be used as a strip-effect baseline (MSVC is a no-op).

Verification

@caomengxuan666
caomengxuan666 merged commit 8a43165 into master Oct 9, 2026
9 checks passed
@caomengxuan666
caomengxuan666 deleted the ci/strip-release branch October 9, 2026 11:53
caomengxuan666 added a commit that referenced this pull request Oct 10, 2026
- Delete docs/eco-harvest-resume-wt97b.md: point-in-time lane resume/handoff snapshot; the harvest/test line now runs on GitHub Actions (eco-harvest-ci.yml) and the diagnosis lives in git history.
- CHANGELOG: add Unreleased entries for strip (#228), setup help/non-tty banner (#229), bundled niugit/ripgrep/fd + setup detection (#230/#231), PROMPT_COMMAND exit jump (#232), PS0 stderr (#233), bracketed paste (#234).

Co-authored-by: docs-audit <[email protected]>
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.

[question/perf] release binary 未 strip (12M),且体积与静态编译相关性说明

1 participant