-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Detect configuration for LLVM during setup #77756
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I would not want to add a dependency for this sort of thing, it shouldn't be necessary to just scan PATH and append llvm-config to it. I don't think appending to the file is going to work well, I think the if-available approach is the one we should pursue. |
050b60a
to
004fd4c
Compare
Is that better? Hopefully the |
004fd4c
to
8f88847
Compare
8f88847
to
b3f6336
Compare
☔ The latest upstream changes (presumably #77867) made this pull request unmergeable. Please resolve the merge conflicts. Note that reviewers usually do not review pull requests until merge conflicts are resolved! Once you resolve the conflicts, you should change the labels applied by bors to indicate that your PR is ready for review. Post this as a comment to change the labels:
|
src/bootstrap/setup.rs
Outdated
[llvm] | ||
# Will download LLVM from CI if available on your platform (Linux only for now) | ||
# https://github.com/rust-lang/rust/issues/77084 tracks support for more platforms | ||
download-ci-llvm = "if-available" |
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.
Could we just duplicate this across the actual default files? I would prefer to avoid adding even more layers of places where defaults are getting set.
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.
Yeah, in my mind setup.rs
is for setting defaults that are not the same for everyone, while src/bootstrap/defaults
are for things that can reasonably be shared.
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.
Done! Added to all default configs. I just have a doubt for the config.codegen.toml
, maybe people working close to codegen don't want the CI built one by default?
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.
Ah, it seems moving these lines to the default profiles broke the bootstrap, because bootstrap.py doesn't know about the profile
setting (I'm guessing it's only handled in the config.rs
file)
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.
Looking further into this, it seems bootstrap only has a basic regex mechanism to lookup toml keys, and returns the first key that matches, which means appending the contents of our default file should work as expected, allowing the main config.toml to override these defaults if needed. Definitely feels like a hack though :D I'll push some code soon
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.
Got it, thanks.
@Mark-Simulacrum how hard would it be to move that into rustbuild instead of bootstrap.py? Doesn't need to block this, but I'd like to do as little as possible in python anyway.
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.
That error comes from the Rust portion of rustbuild, I think? It looks like a Rust error...
Presumably LLVM was not downloaded or not unpacked which led to this problem.
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.
FWIW, I'd be interested in tackling this to get more familiar with the bootstrap code, if you decide to move this to rustbuild :)
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.
Presumably LLVM was not downloaded or not unpacked which led to this problem.
Yes, the rust code doesn't find the executable because it wasn't downloaded by bootstrap.py, because bootstrap.py didn't know about the default file, so the get_toml('download-ci-llvm')
returned None
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.
Let's tackle this in a follow-up, it seems reasonable to have bootstrap.py read profiles anyway.
7345c61
to
c39c869
Compare
7a8deec
to
e65f720
Compare
src/bootstrap/bootstrap.py
Outdated
with open(include_path) as included_toml: | ||
build.config_toml += '\n' + included_toml.read() |
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.
I'm 90% sure this will break - this causes invalid syntax if there's already anything in the config.toml. #76628 (comment)
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.
It would break if parsed by a real TOML parser, but that's not the case, the basic regex parser will just match the first relevant key
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.
(and since the aggregation of the two files is only stored as a string in memory, not written to a toml file somewhere, I don't think it should break anything else?)
e65f720
to
b8ae4c5
Compare
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author |
@bors r+ In a follow-up I'd like to move handling of LLVM from bootstrap.py to rustbuild, but that doesn't need to block this change. |
📌 Commit b8ae4c5 has been approved by |
🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened |
@jyn514 should I open an issue about a follow-up change for rustbuild ? |
It would mean a curl or other "http talker" dep in rustbuild which I'm opposed to at this point I think, but I don't mind an issue. |
☀️ Test successful - checks-actions, checks-azure |
This is a first draft to address #77579, setting
download-ci-llvm
to true on Linux, but I could also implement theif-available
setting mentioned in the issue.On other platforms I was thinking about using the which crate, if adding a dependency on it is considered okay of course, to detect the presence of
llvm-config
in the path, and use it if found. Still a work in progress of course.