fix: GLIBC compatibility — musl static binary for Linux#66
Conversation
Problem: binary compiled on ubuntu-latest (GLIBC 2.39) fails on systems with older GLIBC (e.g. Ubuntu 22.04 has GLIBC 2.35): 'GLIBC_2.39 not found' Fix: - Linux x86_64: switch to musl target (fully static, no GLIBC dep) - Linux aarch64: build on ubuntu-22.04 (GLIBC 2.35) - CI cross-compile: ubuntu-22.04 for Linux - Add musl-tools install step
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
📝 WalkthroughWalkthroughGitHub Actions workflows are updated to specify fixed Ubuntu versions and add musl-based Linux build support. The CI workflow pins the Linux runner to ubuntu-22.04, while the release workflow adds a musl target build with conditional musl-tools installation and upgrades both aarch64 and x86_64-musl builds to ubuntu-22.04. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/release.yml:
- Around line 21-24: The aarch64 job uses cross: true for target:
aarch64-unknown-linux-gnu so the build runs inside cross's container (not the
pinned ubuntu-22.04 runner) and may have a different GLIBC; fix by either
removing or setting cross: false for that target to run on the runner, or add a
Cross.toml that pins the aarch64 target image (e.g., set target.aarch64.image)
to an explicit container built from an ubuntu-22.04 base that provides GLIBC
2.35 so the produced artifact inherits the intended libc version; update the
workflow to reference the chosen approach and ensure the image specified matches
GLIBC 2.35.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ce152e5f-17e4-40f8-8656-d6aa4cc256ef
📒 Files selected for processing (2)
.github/workflows/ci.yml.github/workflows/release.yml
| - target: aarch64-unknown-linux-gnu | ||
| os: ubuntu-latest | ||
| os: ubuntu-22.04 | ||
| name: magic-code-linux-aarch64 | ||
| cross: true |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Checking for cross config files..."
fd -HI 'Cross.toml|cross.toml' | tee /tmp/cross_cfgs.txt || true
if [ -s /tmp/cross_cfgs.txt ]; then
echo "Inspecting cross config for aarch64 target image settings:"
while read -r f; do
echo "---- ${f} ----"
rg -n -C2 'aarch64-unknown-linux-gnu|image\s*=|pre-build' "$f" || true
done < /tmp/cross_cfgs.txt
else
echo "No Cross.toml found; cross likely uses default image/toolchain."
fi
echo "Confirming workflow still uses cross for aarch64:"
rg -n -C2 'aarch64-unknown-linux-gnu|cross:\s*true|cross build' .github/workflows/release.ymlRepository: kienbui1995/mc-code
Length of output: 806
Aarch64 cross-compilation does not inherit GLIBC from the pinned runner.
Pinning the host runner to ubuntu-22.04 (line 22) does not guarantee GLIBC 2.35 for the aarch64 artifact because line 24 uses cross: true. The cross tool executes builds inside its own container image, not on the host runner, so libc comes from that image instead. Without a custom Cross.toml config pinning an explicit image with the intended GLIBC version, the actual GLIBC in the aarch64 binary may differ from your baseline goal.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/release.yml around lines 21 - 24, The aarch64 job uses
cross: true for target: aarch64-unknown-linux-gnu so the build runs inside
cross's container (not the pinned ubuntu-22.04 runner) and may have a different
GLIBC; fix by either removing or setting cross: false for that target to run on
the runner, or add a Cross.toml that pins the aarch64 target image (e.g., set
target.aarch64.image) to an explicit container built from an ubuntu-22.04 base
that provides GLIBC 2.35 so the produced artifact inherits the intended libc
version; update the workflow to reference the chosen approach and ensure the
image specified matches GLIBC 2.35.
|



Problem
Binary compiled on ubuntu-latest (GLIBC 2.39) fails on Ubuntu 22.04 (GLIBC 2.35).
Fix
Summary by CodeRabbit