Skip to content

fix: GLIBC compatibility — musl static binary for Linux#66

Merged
kienbui1995 merged 1 commit intomainfrom
fix/glibc-compat
Apr 14, 2026
Merged

fix: GLIBC compatibility — musl static binary for Linux#66
kienbui1995 merged 1 commit intomainfrom
fix/glibc-compat

Conversation

@kienbui1995
Copy link
Copy Markdown
Owner

@kienbui1995 kienbui1995 commented Apr 14, 2026

Problem

magic-code: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.39' not found

Binary compiled on ubuntu-latest (GLIBC 2.39) fails on Ubuntu 22.04 (GLIBC 2.35).

Fix

  • Linux x86_64: musl target (fully static binary, zero GLIBC dependency)
  • Linux aarch64: build on ubuntu-22.04
  • Install musl-tools in CI

Summary by CodeRabbit

  • Chores
    • Updated CI/CD workflows to standardize Linux builds on Ubuntu 22.04 and added support for musl-based Linux builds.

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
@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

📝 Walkthrough

Walkthrough

GitHub 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

Cohort / File(s) Summary
CI Workflow
.github/workflows/ci.yml
Changed x86_64-unknown-linux-gnu runner from ubuntu-latest to ubuntu-22.04.
Release Workflow
.github/workflows/release.yml
Replaced x86_64-unknown-linux-gnu ubuntu-latest with x86_64-unknown-linux-musl ubuntu-22.04; updated aarch64-unknown-linux-gnu to ubuntu-22.04; added conditional step to install musl-tools when target contains musl.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Workflows refined with runner precision,
Ubuntu twenty-two's our new decision,
Musl tools arrive for builds so lean,
CI pipelines clean, the best we've seen! 🎯

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description identifies the problem clearly and outlines the fix, but deviates from the required template structure with different section headings (Problem/Fix instead of What/Why/How) and omits the checklist entirely. Restructure the description to match the template format: use What/Why/How sections and include the required checklist with verification status.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing GLIBC compatibility through a musl static binary approach for Linux builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/glibc-compat

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between ea3a55c and d982a40.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • .github/workflows/release.yml

Comment on lines 21 to 24
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
os: ubuntu-22.04
name: magic-code-linux-aarch64
cross: true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 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.yml

Repository: 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.

@sonarqubecloud
Copy link
Copy Markdown

@kienbui1995 kienbui1995 merged commit 87c57fd into main Apr 14, 2026
16 checks passed
@kienbui1995 kienbui1995 deleted the fix/glibc-compat branch April 14, 2026 11:32
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