Skip to content

Update s390x-unwind.patch and replace xargo with rustc-build-sysroot#211

Merged
messense merged 8 commits intomainfrom
copilot/update-s390x-unwind-patch
Jan 14, 2026
Merged

Update s390x-unwind.patch and replace xargo with rustc-build-sysroot#211
messense merged 8 commits intomainfrom
copilot/update-s390x-unwind-patch

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 14, 2026

  • Understand the current patch and what it does (adds gcc_eh and libc for s390x musl static linking)
  • Compare the old unwind library structure with the new one using cfg_select! macro
  • Update the patch file to work with the new library structure at lines 73-81
  • Verify the patch format is correct
  • Test that the patch can be applied successfully
  • Replace broken xargo with rustc-build-sysroot
  • Create build-sysroot tool using rustc-build-sysroot library
  • Update build-std.sh to use new tool
  • Update Dockerfile to use new tool
  • Address code review feedback for better error messages
  • Add validation for rustc command success
  • Fix GCC library path to work with GCC 12.4.0 (dynamically detect version)
  • Improve version detection with proper sorting and error handling
  • Add directory existence check to prevent find failures
  • Fix trailing slash consistency in library paths
Original prompt

Update s390x-unwind.patch for latest https://github.com/rust-lang/rust/blob/main/library/unwind/src/lib.rs


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Jan 14, 2026
Co-authored-by: messense <1556054+messense@users.noreply.github.com>
Copilot AI changed the title [WIP] Update s390x-unwind.patch for latest changes Update s390x-unwind.patch for cfg_select! macro refactoring Jan 14, 2026
Copilot AI requested a review from messense January 14, 2026 04:00
@messense messense marked this pull request as ready for review January 14, 2026 04:11
Copilot AI review requested due to automatic review settings January 14, 2026 04:11
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the s390x-unwind.patch file to align with recent upstream Rust library refactoring that replaced if/else conditionals with the cfg_select! macro. The patch maintains its original purpose of fixing pthread_once dependency issues when statically linking on s390x musl systems.

Changes:

  • Updated line numbers from 51 to 74 to match upstream file structure
  • Changed context from } else { to _ => { to reflect cfg_select! default branch syntax
  • Added hexagon architecture exclusion to gcc_s link directive per upstream changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@messense
Copy link
Copy Markdown
Member

xargo is broken now

#22 1.740    Compiling xargo v0.3.26 (/root/.cargo/git/checkouts/xargo-91d1a9b6feaf8e34/21f59b6)
#22 1.860    Compiling semver v1.0.27
#22 1.877    Compiling same-file v1.0.6
#22 1.970    Compiling memchr v2.7.6
#22 2.438    Compiling dirs-sys v0.3.7
#22 2.484    Compiling rand v0.4.6
#22 2.926    Compiling itoa v1.0.17
#22 3.109    Compiling tempdir v0.3.7
#22 3.222    Compiling dirs v4.0.0
#22 3.294    Compiling fs2 v0.4.3
#22 3.317    Compiling rustc_version v0.4.1
#22 3.397    Compiling walkdir v2.5.0
#22 4.249    Compiling toml v0.5.11
#22 5.234 error: the feature `file_lock` has been stable since 1.89.0 and no longer requires an attribute to enable
#22 5.234  --> src/lib.rs:2:12
#22 5.234   |
#22 5.234 2 | #![feature(file_lock)]
#22 5.235   |            ^^^^^^^^^
#22 5.235   |
#22 5.235 note: the lint level is defined here
#22 5.235  --> src/lib.rs:1:9
#22 5.235   |
#22 5.235 1 | #![deny(warnings)]
#22 5.235   |         ^^^^^^^^
#22 5.235   = note: `#[deny(stable_features)]` implied by `#[deny(warnings)]`
#22 5.235 
#22 5.306 error[E0308]: mismatched types
#22 5.306    --> src/flock.rs:121:41
#22 5.306     |
#22 5.306 121 |                         Err(err) => Err(err)
#22 5.306     |                                     --- ^^^ expected `Error`, found `TryLockError`
#22 5.306     |                                     |
#22 5.306     |                                     arguments to this enum variant are incorrect
#22 5.306     |
#22 5.306 help: the type constructed contains `std::fs::TryLockError` due to the type of the argument passed
#22 5.306    --> src/flock.rs:121:37
#22 5.306     |
#22 5.306 121 |                         Err(err) => Err(err)
#22 5.306     |                                     ^^^^---^
#22 5.306     |                                         |
#22 5.306     |                                         this argument influences the type of `Err`
#22 5.306 note: tuple variant defined here
#22 5.306    --> /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/result.rs:566:5
#22 5.306     |
#22 5.306 566 |     Err(#[stable(feature = "rust1", since = "1.0.0")] E),
#22 5.306     |     ^^^
#22 5.306 help: call `Into::into` on this expression to convert `std::fs::TryLockError` into `std::io::Error`
#22 5.306     |
#22 5.306 121 |                         Err(err) => Err(err.into())
#22 5.306     |                                            +++++++
#22 5.306 
#22 5.467 For more information about this error, try `rustc --explain E0308`.
#22 5.473 error: could not compile `xargo` (lib) due to 2 previous errors
#22 5.475 warning: build failed, waiting for other jobs to finish...
#22 6.278 error: failed to compile `xargo v0.3.26 (https://github.com/AverseABFun/xargo.git#21f59b6a)`, intermediate artifacts can be found at `/tmp/cargo-install5e5rM6`.
#22 6.278 To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
#22 ERROR: process "/bin/sh -c bash build-std.sh" did not complete successfully: exit code: 101

could you try to replace it with maybe https://github.com/RalfJung/rustc-build-sysroot?

@copilot

Co-authored-by: messense <1556054+messense@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 14, 2026

xargo is broken now

...

Replaced xargo with rustc-build-sysroot in commit 4431176. Created a custom build-sysroot tool that uses the rustc-build-sysroot library to build the sysroot, which should resolve the compilation errors you were seeing with xargo.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/RalfJung/rustc-build-sysroot/contents
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)
  • https://api.github.com/search/code
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI and others added 2 commits January 14, 2026 06:31
Co-authored-by: messense <1556054+messense@users.noreply.github.com>
Co-authored-by: messense <1556054+messense@users.noreply.github.com>
Copilot AI changed the title Update s390x-unwind.patch for cfg_select! macro refactoring Update s390x-unwind.patch and replace xargo with rustc-build-sysroot Jan 14, 2026
@messense
Copy link
Copy Markdown
Member

@copilot CI failed with:

#22 10.62 Building sysroot for target: s390x-unknown-linux-musl
#22 10.62 Source directory: /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library
#22 10.62 Sysroot directory: /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/s390x-unknown-linux-musl
#22 10.62 Using RUSTFLAGS: ["-L/usr/local/musl/s390x-unknown-linux-musl/lib", "-L/usr/local/musl/lib/gcc/s390x-unknown-linux-musl/11.2.0/"]
#22 31.69 Sysroot built successfully!
#22 31.70 cp: cannot stat '/usr/local/musl/lib/gcc/s390x-unknown-linux-musl/11.2.0/c*.o': No such file or directory
#22 ERROR: process "/bin/sh -c bash build-std.sh" did not complete successfully: exit code: 1
------
 > [15/16] RUN bash build-std.sh:
6.264    Compiling toml v0.8.23
7.549    Compiling rustc-build-sysroot v0.5.11
10.25    Compiling build-sysroot v0.1.0 (/tmp/build-sysroot)
10.55     Finished `release` profile [optimized] target(s) in 10.40s
10.62 Building sysroot for target: s390x-unknown-linux-musl
10.62 Source directory: /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library
10.62 Sysroot directory: /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/s390x-unknown-linux-musl
10.62 Using RUSTFLAGS: ["-L/usr/local/musl/s390x-unknown-linux-musl/lib", "-L/usr/local/musl/lib/gcc/s390x-unknown-linux-musl/11.2.0/"]
31.69 Sysroot built successfully!
31.70 cp: cannot stat '/usr/local/musl/lib/gcc/s390x-unknown-linux-musl/11.2.0/c*.o': No such file or directory
------
Dockerfile:120
--------------------
 118 |     ADD build-sysroot /home/rust/src/build-sysroot
 119 |     ADD build-std.sh .
 120 | >>> RUN bash build-std.sh
 121 |     
 122 |     ENV RUSTUP_HOME=/root/.rustup
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c bash build-std.sh" did not complete successfully: exit code: 1

Please help fix this.

…ing 11.2.0

Co-authored-by: messense <1556054+messense@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 14, 2026

@copilot CI failed with:

Fixed in commit c51d2ef. The issue was that the GCC version was hardcoded to 11.2.0 but config.mak specifies GCC 12.4.0. The script now dynamically detects the GCC library directory instead of hardcoding the version, so it will work with any GCC version configured in config.mak.

Copilot AI and others added 2 commits January 14, 2026 10:56
Co-authored-by: messense <1556054+messense@users.noreply.github.com>
…istency

Co-authored-by: messense <1556054+messense@users.noreply.github.com>
@messense messense merged commit 5077f51 into main Jan 14, 2026
41 checks passed
@messense messense deleted the copilot/update-s390x-unwind-patch branch January 14, 2026 12:21
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.

3 participants