Skip to content

fix: fix x86 build#137

Merged
chengwenxi merged 1 commit into
mainfrom
build-x86
Jun 24, 2026
Merged

fix: fix x86 build#137
chengwenxi merged 1 commit into
mainfrom
build-x86

Conversation

@chengwenxi

@chengwenxi chengwenxi commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved Linux build reliability for one cross-compilation target, reducing failures caused by compiler incompatibilities.
    • Ensured native dependencies are compiled with a more stable toolchain, helping prevent miscompiled builds.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Cross.toml gains a pre-build hook for the x86_64-unknown-linux-gnu target that installs gcc-10 and g++-10 via apt-get and uses update-alternatives to redirect the gcc, g++, and cc symlinks to GCC 10, with inline comments identifying the compiler bug being mitigated.

Changes

GCC 10 Cross Build Configuration

Layer / File(s) Summary
GCC 10 pre-build hook and compiler symlinks
Cross.toml
Adds [target.x86_64-unknown-linux-gnu] pre-build commands to install gcc-10/g++-10 and update gcc, g++, and cc symlinks via update-alternatives; inline comments document the compiler miscompilation being worked around.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • morph-l2/morph-reth#83: Also modifies Cross.toml with a pre-build hook to install toolchain dependencies (LLVM/Clang) for cross-compilation, using the same configuration pattern.
  • morph-l2/morph-reth#84: Directly modifies the Cross.toml pre-build section for cross-compilation setup, structurally overlapping with this change.

Suggested reviewers

  • curryxbo

Poem

🐇 A rabbit once built cross and true,
But GCC nine made binaries askew.
So ten was installed, symlinks repointed with care,
update-alternatives banished the bug from its lair.
Now morph-reth compiles without a mis-step to bear! 🔧

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the PR’s main goal: fixing the x86 build.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch build-x86

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Cross.toml`:
- Around line 12-16: The Cross.toml pre-build setup only registers GCC 10 with
update-alternatives but does not force it to become the active compiler. Update
the pre-build commands so that after the existing update-alternatives --install
calls, both the gcc and cc groups are explicitly selected to GCC 10 using --set,
ensuring the x86 build uses the intended compiler; keep the change within the
pre-build array where the gcc/cc alternatives are configured.
🪄 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: 27407685-080a-4363-9cf9-d30ac8d6e289

📥 Commits

Reviewing files that changed from the base of the PR and between bb8514d and fcbbbbc.

📒 Files selected for processing (1)
  • Cross.toml

Comment thread Cross.toml
Comment on lines +12 to +16
pre-build = [
"apt-get update && apt-get install --assume-yes gcc-10 g++-10",
"update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10",
"update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-10 100",
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Does update-alternatives --installswitch the active alternative when a group is already in manual mode, or is an explicit--set required?

💡 Result:

When a link group is in manual mode, the update-alternatives --install command will add the new alternative to the group's list of options, but it will not switch the active alternative [1][2]. The system respects the administrator's previous manual selection and will not automatically update the symlinks, even if the newly installed alternative has a higher priority [1][3][2]. To switch the active alternative in this scenario, you must either: 1. Use the --config command to interactively select the desired alternative [4]. 2. Use the --set command to explicitly define the active alternative [3]. In summary, an explicit action by the administrator is required to change the active link when the group is in manual mode [1][2].

Citations:


Force-select GCC 10 after registering the alternatives.

update-alternatives --install only adds the choice; if the group is already in manual mode, gcc/cc can stay on the previous compiler. Add explicit --set for both groups so the x86 build actually uses GCC 10.

Suggested patch
 pre-build = [
     "apt-get update && apt-get install --assume-yes gcc-10 g++-10",
     "update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10",
     "update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-10 100",
+    "update-alternatives --set gcc /usr/bin/gcc-10",
+    "update-alternatives --set cc /usr/bin/gcc-10",
 ]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
pre-build = [
"apt-get update && apt-get install --assume-yes gcc-10 g++-10",
"update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10",
"update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-10 100",
]
pre-build = [
"apt-get update && apt-get install --assume-yes gcc-10 g++-10",
"update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10",
"update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-10 100",
"update-alternatives --set gcc /usr/bin/gcc-10",
"update-alternatives --set cc /usr/bin/gcc-10",
]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Cross.toml` around lines 12 - 16, The Cross.toml pre-build setup only
registers GCC 10 with update-alternatives but does not force it to become the
active compiler. Update the pre-build commands so that after the existing
update-alternatives --install calls, both the gcc and cc groups are explicitly
selected to GCC 10 using --set, ensuring the x86 build uses the intended
compiler; keep the change within the pre-build array where the gcc/cc
alternatives are configured.

@chengwenxi chengwenxi changed the title fix x86 build fix: fix x86 build Jun 24, 2026
@chengwenxi chengwenxi merged commit 773887b into main Jun 24, 2026
19 of 21 checks passed
@chengwenxi chengwenxi deleted the build-x86 branch June 24, 2026 09:48
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.

2 participants