-
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
Rebuild llvm spuriously less frequently #138333
Open
jyn514
wants to merge
1
commit into
rust-lang:master
Choose a base branch
from
jyn514:spurious-llvm-rebuilds
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+13
−1
Conversation
This file contains 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
r? @onur-ozkan rustbot has assigned @onur-ozkan. Use |
This comment has been minimized.
This comment has been minimized.
I noticed that `x check` was rebuilding rustc_llvm basically every time I modified a source file. I tracked this down to the following env variable change: ``` cargo::core::compiler::fingerprint: dirty: EnvVarChanged { name: "REAL_LIBRARY_PATH", old_value: Some("/home/jyn/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib"), new_value: None } ``` The problem was that I had installed rust-analyzer from rustup, not as a standalone tool. As a result, rustup sets `LD_LIBRARY_PATH=$(rustc --print target-libdir)` in the environment under the assumption that rust-analyzer needs it to link to rustc_private crates. This is not in fact the case; RA does not link to rustc_private. But rustup does not know this. Ideally we would make rustup smarter, but that takes a while because rustup has infrequent releases. In the meantime, as a workaround, be a little more selective about when we forward LD_LIBRARY_PATH. See the new comment for more details.
a191eb0
to
2a8c87b
Compare
onur-ozkan
approved these changes
Mar 11, 2025
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.
Thanks!
@bors r+ |
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)
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.
I noticed that
x check
was rebuilding rustc_llvm basically every time I modified a source file. I tracked this down to the following env variable change:The problem was that I had installed rust-analyzer from rustup, not as a standalone tool. As a result, rustup sets
LD_LIBRARY_PATH=$(rustc --print target-libdir)
in the environment under the assumption that rust-analyzer needs it to link to rustc_private crates. This is not in fact the case; RA does not link to rustc_private. But rustup does not know this. Ideally we would make rustup smarter, but that takes a while because rustup has infrequent releases.In the meantime, as a workaround, be a little more selective about when we forward LD_LIBRARY_PATH. See the new comment for more details.
Note that there are still cases when we will spuriously rebuild; in particular when setting
llvm-config = /path/to/llvm-config
and using rust-analyzer installed from rustup. but both of those are individually rare, and the combination seems very unlikely to me.