-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Cross-compiling from x86_64-linux to aarch64-darwin produces a broken (stripped) dylib #141913
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-macosOperating system: macOSOperating system: macOSP-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixesIssue expected to be fixed by the next major LLVM upgrade, or backported fixesregression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-macosOperating system: macOSOperating system: macOSP-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixesIssue expected to be fixed by the next major LLVM upgrade, or backported fixesregression-untriagedUntriaged performance or correctness regression.Untriaged performance or correctness regression.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I am cross-compiling from a Linux
x86_64host toaarch64-apple-darwin.Since Rust 1.87.0 this results in a broken
dylibfile when it gets stripped.This worked ok up through 1.86.0
Unfortunately I'm not able to reproduce that on a really small example, but a reproduction case is available in https://github.com/badboy/rocketscience/tree/broken-dylib
Note that this requires additional tooling:
The included
run.shdownloads all requirements and setsRUSTFLAGSaccordingly.All that is required is:
RUSTFLAGSis this:The final
dylibattarget/aarch64-apple-darwin/release/librocketscience.dylibshould be inspectable byaarch64-apple-darwin-nm.When it's not it will error out.
On Rust 1.87.0 and 1.89.0-nightly (99e7c15 2025-06-01) it fails:
On Rust 1.86.0 or when setting
strip = falseinCargo.tomlit works:This is all due to the bundled
rust-objcopy.Manually running the
rust-objcopycommand on the not-broken dylib thatcargoalso runs produces the brokendylib:This does NOT happen when building on my aarch64 macOS machine, only when cross-compiling.
This all sounds very similar to #138212.
Back then it was an upstream bug, so this might be another one.
Or is this due to mixing and matching the toolchains in an incompatible way?
Version it worked on
Version with regression