Skip to content
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

improvements on initial sysroot and libdir finding logics #132782

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

onur-ozkan
Copy link
Member

Stabilized initial sysroot and libdir path resolution logic to work without dry-run conditions and utilized initial sysroot more broadly.

@rustbot
Copy link
Collaborator

rustbot commented Nov 8, 2024

r? @albertlarsan68

rustbot has assigned @albertlarsan68.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 8, 2024
@rustbot
Copy link
Collaborator

rustbot commented Nov 8, 2024

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

Comment on lines 340 to 330
// FIXME(Zalathar): Determining this path occasionally fails locally for
// unknown reasons, so we print some extra context to help track down why.
let find_initial_libdir = || {
let initial_libdir =
initial_target_dir.parent()?.parent()?.strip_prefix(&initial_sysroot).ok()?;
Some(initial_libdir.to_path_buf())
};
let Some(initial_libdir) = find_initial_libdir() else {
panic!(
"couldn't determine `initial_libdir`:
- config.initial_rustc: {rustc:?}
- initial_target_libdir_str: {initial_target_libdir_str:?}
- initial_target_dir: {initial_target_dir:?}
- initial_sysroot: {initial_sysroot:?}
",
rustc = config.initial_rustc,
);
};
let initial_libdir = initial_target_dir
.ancestors()
.nth(2)
.unwrap()
.strip_prefix(&config.initial_sysroot)
.unwrap()
.to_path_buf();
Copy link
Member Author

Choose a reason for hiding this comment

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

I have never experienced this failing before and it should be even more stable now.

cc @Zalathar

Copy link
Contributor

Choose a reason for hiding this comment

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

I still see this fail occasionally (on macOS only), but I have already collected plenty of examples of the failure so I don’t really need this code any more.

If you replace the unwrap with something like .expect("couldn’t determine initial libdir"), I’m fine with that.

Copy link
Contributor

Choose a reason for hiding this comment

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

For reference, the failure looks like this: #130138 (comment)

Two different invocations of the same compiler binary produce different sysroot paths. It probably has something to do with hardlink bookkeeping on macOS specifically.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see above that we aren’t invoking rustc multiple times anymore, so yeah from a bootstrap perspective this should avoid the problem I was seeing.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you replace the unwrap with something like .expect("couldn’t determine initial libdir"), I’m fine with that.

Done that in https://github.com/rust-lang/rust/compare/16f30f2f2d92ee450e4ec715ee09e17dc2c1f5b8..27323aac9fdb905e0665fc9c43147a895ef51da6.

@onur-ozkan
Copy link
Member Author

onur-ozkan commented Nov 29, 2024

r? bootstrap (due to inactivity)

@rustbot rustbot assigned jieyouxu and unassigned albertlarsan68 Nov 29, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, this looks like a nice cleanup.

@jieyouxu
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 29, 2024

📌 Commit 27323aa has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 29, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 29, 2024
improvements on initial sysroot and libdir finding logics

Stabilized initial sysroot and libdir path resolution logic to work without dry-run conditions and utilized initial sysroot more broadly.
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#132782 (improvements on initial sysroot and libdir finding logics)
 - rust-lang#133134 (Don't use a SyntheticProvider for literally every type)
 - rust-lang#133466 (Fix typos in pin.rs)
 - rust-lang#133492 (bootstrap: allow skipping steps with start of path)
 - rust-lang#133501 (support revealing defined opaque post borrowck)
 - rust-lang#133530 (Use consistent wording in docs, use is zero instead of is 0)
 - rust-lang#133538 (Better diagnostic for fn items in variadic functions)
 - rust-lang#133590 (Rename `-Zparse-only`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#132782 (improvements on initial sysroot and libdir finding logics)
 - rust-lang#133466 (Fix typos in pin.rs)
 - rust-lang#133492 (bootstrap: allow skipping steps with start of path)
 - rust-lang#133501 (support revealing defined opaque post borrowck)
 - rust-lang#133530 (Use consistent wording in docs, use is zero instead of is 0)
 - rust-lang#133538 (Better diagnostic for fn items in variadic functions)
 - rust-lang#133590 (Rename `-Zparse-only`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 45fd6b4 into rust-lang:master Nov 29, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Nov 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2024
Rollup merge of rust-lang#132782 - onur-ozkan:cleanup, r=jieyouxu

improvements on initial sysroot and libdir finding logics

Stabilized initial sysroot and libdir path resolution logic to work without dry-run conditions and utilized initial sysroot more broadly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants