Improve xcrun error handling#139010
Merged
bors merged 4 commits intorust-lang:masterfrom Mar 28, 2025
Merged
Conversation
I've intentionally used slightly vague language ("roughly"), as we don't
want to guarantee the exact invocation of `xcrun`, just hint that it's
close to that.
It can be a fairly expensive operation when the output is not cached, so it's nice to get some visibility into the runtime cost.
Collaborator
|
Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb Some changes occurred in compiler/rustc_codegen_ssa |
This comment has been minimized.
This comment has been minimized.
37a78c0 to
4f68498
Compare
Also allow the SDK path to be non-UTF-8.
4f68498 to
89348e5
Compare
wesleywiser
approved these changes
Mar 27, 2025
Member
wesleywiser
left a comment
There was a problem hiding this comment.
Overall, this looks great! I don't have the proper setup to test it but it sounds like you already have.
Member
|
@bors r+ |
Collaborator
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Mar 27, 2025
…eywiser Improve `xcrun` error handling The compiler invokes `xcrun` on macOS when linking Apple targets, to find the Xcode SDK which contain all the necessary linker stubs. The error messages that `xcrun` outputs aren't always that great though, so this PR tries to improve that by providing extra context when an error occurs. Fixes rust-lang#56829. Fixes rust-lang#84534. Part of rust-lang#129432. See also the alternative rust-lang#131433. Tested on: - `x86_64-apple-darwin`, MacBook Pro running Mac OS X 10.12.6 - With no tooling installed - With Xcode 9.2 - With Xcode 9.2 Commandline Tools - `aarch64-apple-darwin`, MacBook M2 Pro running macOS 14.7.4 - With Xcode 13.4.1 - With Xcode 16.2 - Inside `nix-shell -p xcbuild` (nixpkgs' `xcrun` shim) - `aarch64-apple-darwin`, VM running macOS 15.3.1 - With no tooling installed - With Xcode 16.2 Commandline Tools `@rustbot` label O-apple r? compiler CC `@BlackHoleFox` `@thomcc`
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 28, 2025
Rollup of 5 pull requests Successful merges: - rust-lang#138104 (Greatly simplify doctest parsing and information extraction) - rust-lang#139010 (Improve `xcrun` error handling) - rust-lang#139021 (std: get rid of pre-Vista fallback code) - rust-lang#139026 (Use `abs_diff` where applicable) - rust-lang#139030 (saethlin goes on vacation) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 28, 2025
Rollup of 6 pull requests Successful merges: - rust-lang#138720 (Specify a concrete stack size in channel tests) - rust-lang#139010 (Improve `xcrun` error handling) - rust-lang#139021 (std: get rid of pre-Vista fallback code) - rust-lang#139025 (Do not trim paths in MIR validator) - rust-lang#139026 (Use `abs_diff` where applicable) - rust-lang#139030 (saethlin goes on vacation) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 28, 2025
Rollup of 6 pull requests Successful merges: - rust-lang#138720 (Specify a concrete stack size in channel tests) - rust-lang#139010 (Improve `xcrun` error handling) - rust-lang#139021 (std: get rid of pre-Vista fallback code) - rust-lang#139025 (Do not trim paths in MIR validator) - rust-lang#139026 (Use `abs_diff` where applicable) - rust-lang#139030 (saethlin goes on vacation) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Mar 28, 2025
Rollup merge of rust-lang#139010 - madsmtm:parse-xcrun-better, r=wesleywiser Improve `xcrun` error handling The compiler invokes `xcrun` on macOS when linking Apple targets, to find the Xcode SDK which contain all the necessary linker stubs. The error messages that `xcrun` outputs aren't always that great though, so this PR tries to improve that by providing extra context when an error occurs. Fixes rust-lang#56829. Fixes rust-lang#84534. Part of rust-lang#129432. See also the alternative rust-lang#131433. Tested on: - `x86_64-apple-darwin`, MacBook Pro running Mac OS X 10.12.6 - With no tooling installed - With Xcode 9.2 - With Xcode 9.2 Commandline Tools - `aarch64-apple-darwin`, MacBook M2 Pro running macOS 14.7.4 - With Xcode 13.4.1 - With Xcode 16.2 - Inside `nix-shell -p xcbuild` (nixpkgs' `xcrun` shim) - `aarch64-apple-darwin`, VM running macOS 15.3.1 - With no tooling installed - With Xcode 16.2 Commandline Tools ``@rustbot`` label O-apple r? compiler CC ``@BlackHoleFox`` ``@thomcc``
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The compiler invokes
xcrunon macOS when linking Apple targets, to find the Xcode SDK which contain all the necessary linker stubs. The error messages thatxcrunoutputs aren't always that great though, so this PR tries to improve that by providing extra context when an error occurs.Fixes #56829.
Fixes #84534.
Part of #129432.
See also the alternative #131433.
Tested on:
x86_64-apple-darwin, MacBook Pro running Mac OS X 10.12.6aarch64-apple-darwin, MacBook M2 Pro running macOS 14.7.4nix-shell -p xcbuild(nixpkgs'xcrunshim)aarch64-apple-darwin, VM running macOS 15.3.1@rustbot label O-apple
r? compiler
CC @BlackHoleFox @thomcc