Skip to content

fix: portable SHA256 verification and direct sccache invocation#209

Merged
jas88 merged 6 commits intomainfrom
fix/download-checksum-verification
Mar 9, 2026
Merged

fix: portable SHA256 verification and direct sccache invocation#209
jas88 merged 6 commits intomainfrom
fix/download-checksum-verification

Conversation

@jas88
Copy link
Copy Markdown
Owner

@jas88 jas88 commented Mar 9, 2026

Summary

Follow-up to #208, addressing issues found in CI:

  • Portable SHA256: macOS BSD sha256sum doesn't support --check --status. Replaced with compute-and-compare approach using shasum (preferred) or sha256sum
  • Validate before writing: check-native-updates.sh now validates computed hashes are 64-char hex before writing to build-config.sh, and sources build-config.sh in the current shell so sha256_compute is actually available
  • Direct sccache: Replaced shell script wrappers (exec sccache compiler) with CC="sccache compiler" directly, eliminating a fork+exec per compilation. Quoted "CC=$CC" in make commands to handle the space

Test plan

  • macOS build succeeds (SHA256 verification works with shasum)
  • Linux build succeeds (SHA256 verification + sccache direct invocation)
  • Windows cross-compile succeeds (sccache auto-detected)

High-level PR Summary

This PR fixes cross-platform SHA256 verification issues and optimizes compiler caching. The main changes include replacing GNU-specific sha256sum --check --status with a portable compute-and-compare approach using shasum or sha256sum (compatible with macOS BSD and Linux), adding SHA256 checksums to build-config.sh with validation, and replacing shell script wrappers with direct CC="sccache compiler" invocation to eliminate unnecessary fork+exec overhead per compilation. The update script now computes and validates checksums when updating dependency versions.

⏱️ Estimated Review Time: 15-30 minutes

💡 Review Order Suggestion
Order File Path
1 native/build-config.sh
2 scripts/check-native-updates.sh
3 native/build-linux.sh
4 native/build-linux-arm.sh
5 native/build-linux-arm64.sh
6 native/build-linux-x86.sh
7 native/build-windows.sh
8 .github/workflows/build.yml

Need help? Join our Discord


Summary by cubic

Make SHA256 verification portable across macOS and Linux and invoke sccache directly to improve CI reliability and build performance.

  • Bug Fixes

    • Use compute-and-compare SHA256 via shasum or sha256sum (no --check flags) with new sha256_compute and sha256_check helpers.
    • Add and verify checksums for all native library downloads in native/build-config.sh.
    • In CI, download autoconf and automake to files and verify SHA256, allowing HTTP mirror redirects safely.
    • Validate 64-char hex before writing checksums and source build-config.sh in the current shell so helpers are available.
  • Refactors

    • Replace wrapper scripts with CC="sccache <compiler>" and CXX="sccache <compiler>"; quote "CC=$CC", "AR=$AR", and "RANLIB=$RANLIB" in make calls to handle spaces.
    • Auto-detect sccache on Windows and use it when present.
    • Remove PATH-based wrapper bin dirs from Linux build scripts and drop the CI sccache-wrapper step.

Written for commit 5b0dfb6. Summary will update on new commits.

jas88 added 5 commits March 9, 2026 10:12
Fixes CI failure where autoconf download via ftpmirror.gnu.org failed
because --proto =https blocked HTTP mirror redirects. Downloads now go
to files with SHA256 verification instead of piping to tar, making
HTTP redirects safe. Also adds checksums for all 8 library downloads
in build-config.sh and auto-updates them in check-native-updates.sh.
Add portable sha256_check/sha256_compute helpers that work with both
sha256sum (Linux) and shasum (macOS), failing explicitly if neither is
available. Validate computed hashes are 64-char hex before writing to
build-config.sh. Use sha256sum in build.yml since the runner is Ubuntu.
macOS BSD sha256sum doesn't support --check/--status flags. Replace
flag-based verification with compute-and-compare approach. Prefer
shasum (available on macOS and most Linux) over sha256sum.
sha256_compute was defined in build-config.sh but only sourced in a
subshell for URL extraction, making it unavailable for hash computation.
Source in current shell so both the URL variables and helper functions
are accessible.
Replace per-compiler shell script wrappers with CC="sccache compiler"
directly, eliminating an extra fork+exec per compilation. Quote CC=$CC
in make commands to handle the space in the value. Windows build script
auto-detects sccache availability for local use without it.
Copy link
Copy Markdown

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

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

Review by RecurseML

🔍 Review performed on 6dbcd67..2e8f206

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (8)

.github/workflows/build.yml
native/build-config.sh
native/build-linux-arm.sh
native/build-linux-arm64.sh
native/build-linux-x86.sh
native/build-linux.sh
native/build-windows.sh
scripts/check-native-updates.sh

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 8 files

@jas88 jas88 merged commit 834228a into main Mar 9, 2026
5 checks passed
@jas88 jas88 deleted the fix/download-checksum-verification branch March 9, 2026 17:26
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