-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve xcrun
error handling
#139010
Improve xcrun
error handling
#139010
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.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks great! I don't have the proper setup to test it but it sounds like you already have.
@bors r+ |
…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`
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
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
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
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``
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 thatxcrun
outputs 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'xcrun
shim)aarch64-apple-darwin
, VM running macOS 15.3.1@rustbot label O-apple
r? compiler
CC @BlackHoleFox @thomcc