Skip to content

avoid rustc_llvm rebuilds when LD_LIBRARY_PATH changes #104375

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

Closed
wants to merge 1 commit into from

Conversation

RalfJung
Copy link
Member

Currently the fairly slow rustc_llvm build script gets rerun every time LD_LIBRARY_PATH changes. So if one has an IDE setup where LD_LIBRARY_PATH inside the IDE differs from the one on the host, rebuilds happen all the time.

With LLVM being downloaded from CI, this REAL_LIBRARY_PATH stuff does not seem needed any more, at least not on my system. But I also don't really understand what happens here. Does a patch like this make sense?

r? @jyn514 @Mark-Simulacrum
Cc @bjorn3

@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 13, 2022
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

This makes sense to me since REAL_LIBRARY_PATH_VAR is still tracked. I'd prefer for Mark to take a look before I approve though.

@Mark-Simulacrum
Copy link
Member

With LLVM being downloaded from CI, this REAL_LIBRARY_PATH stuff does not seem needed any more, at least not on my system. But I also don't really understand what happens here. Does a patch like this make sense?

I believe this is still necessary -- the CI LLVM should apply to your local build, but without this you might pull in the beta LLVM (which is a different LLVM). And, in any case, the CI LLVM should not have changed anything since we aren't always using it.

@bors r=jyn514,Mark-Simulacrum

@bors
Copy link
Collaborator

bors commented Nov 14, 2022

📌 Commit d634c1c has been approved by jyn514,Mark-Simulacrum

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 14, 2022
@RalfJung
Copy link
Member Author

RalfJung commented Nov 14, 2022 via email

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Nov 14, 2022
…514,Mark-Simulacrum

avoid rustc_llvm rebuilds when LD_LIBRARY_PATH changes

Currently the fairly slow rustc_llvm build script gets rerun every time LD_LIBRARY_PATH changes. So if one has an IDE setup where LD_LIBRARY_PATH inside the IDE differs from the one on the host, rebuilds happen all the time.

With LLVM being downloaded from CI, this REAL_LIBRARY_PATH stuff does not seem needed any more, at least not on my system. But I also don't really understand what happens here. Does a patch like this make sense?

r? `@jyn514`  `@Mark-Simulacrum`
Cc `@bjorn3`
cargo.env("REAL_LIBRARY_PATH_VAR", &util::dylib_path_var());
if let Some(e) = env::var_os(util::dylib_path_var()) {
cargo.env("REAL_LIBRARY_PATH", e);
if !self.config.llvm_from_ci {
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I missed this part of the diff.

@Mark-Simulacrum
Copy link
Member

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 14, 2022
@Mark-Simulacrum
Copy link
Member

I suspect like with other IDE specific differences it's possible that our answer has to involve changing how your IDE invokes x.py (e.g. setting the ld library path to your system one just before).

I think the alternative is isolating the changes to the env variable - we should be able to figure out a specific set of things that need to be in the dynamic library path, I suspect, and reduce to that. It's probably pretty annoying to do that though.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 14, 2022
@Mark-Simulacrum
Copy link
Member

I'll see if I can produce an example that breaks with this, so we can bounce off of that.

@RalfJung
Copy link
Member Author

I know my IDE setup is pretty special, so if this doesn't work that's fine and I will add some local hacks. I just thought maybe there is a nice solution here since CI LLVM is less complicated than the case where LLVM is built locally. But if it doesn't work, then I'll find another way.

@Mark-Simulacrum
Copy link
Member

Locally built and CI llvm should be the same for linking purposes, I think, at least loosely speaking.

@RalfJung RalfJung closed this Nov 20, 2022
@RalfJung RalfJung deleted the rustc_llvm_rebuild branch November 20, 2022 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants