-
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
Add remark for missing llvm-tools
component re. rustc_private
linker failures related to not finding LLVM libraries
#137931
Conversation
@@ -469,6 +469,9 @@ impl<G: EmissionGuarantee> Diagnostic<'_, G> for LinkingFailed<'_> { | |||
diag.note(fluent::codegen_ssa_use_cargo_directive); | |||
} | |||
} | |||
if self.linker_path.display().to_string().contains("cc") { |
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.
this will show up for every linker error, when though almost all linker errors are not caused by this.
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 change the condition
if self.escaped_output.contains("unable to find library -lLLVM-") {
Is that correct?
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.
Not really, this only applies to rustc_private, not all links against LLVM.
And doing this kind of linker string error parsing is very unreliable in general and should only be done very carefully if at all.
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.
Oh, this does require careful consideration. Do you have any good suggestions? Do I need to check the rustc_private
feature?
I do not think we should be making this suggestion for a few reasons:
Footnotes
|
Good point. However, could this suggestion serve as a reminder of a potential solution? It doesn't seem to get timely feedback if it's written in the documentation. |
i disagree with this point. we should still help people with this confusing thing if possible. i've seen people that were very confused by this (and so was I trying to help them!). but I yes, I don't like linker string matching so I'm not very inclined to merge this PR's solution (especially because as implemented today it will likely be incorrect in many cases where it happens). |
That seems fair. I think I would rather still see this as docs in rustc-dev-guide or docs on the unstable feature itself. I don't really want to merge the string matching here either (I don't really have a good heuristic alternative, because AFAIK @xizheyin maybe change this PR into documenting this in unstable-features book and/or rustc-dev-guide, I'd r+ that. |
I got it, if compiler can't provide sufficient information, we have to record it in the document. But, could we provide a web link to the docs where record some potential solutions? |
the problem here is that it's basically impossible to detect whether this specific problem is occurring. any detection algorithm will be wrong in many cases, which we don't want. |
To further elaborate, I don't want to add this as a diagnostics because it's also quite misleading if the cause isn't that |
Ok, I'll close it. Maybe a note in the documentation would be a better choice. |
Sure. Feel free to r/? me if you submit a doc PR. |
Ok, I have submit a PR in |
Some changes occurred in compiler/rustc_codegen_ssa |
This comment has been minimized.
This comment has been minimized.
@rustbot label -S-waiting-on-review |
r? @jieyouxu |
Could not assign reviewer from: |
llvm-tools
component re. rustc_private
linker failures related to not finding LLVM libraries
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. Can you squash your commits into one?
It's done. @jieyouxu |
Cheers. |
This comment has been minimized.
This comment has been minimized.
@bors r- |
You'll have to change the code blocks to use
to avoid the book interpreting them as valid Rust code and trying to run them as doctests. |
I modified and squashed the commit. Thank you! @jieyouxu |
…failures related to not finding LLVM libraries Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
@bors r+ |
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#137931 (Add remark for missing `llvm-tools` component re. `rustc_private` linker failures related to not finding LLVM libraries) - rust-lang#138138 (Pass `InferCtxt` to `InlineAsmCtxt` to properly taint on error) - rust-lang#138223 (Fix post-merge workflow) - rust-lang#138268 (Handle empty test suites in GitHub job summary report) - rust-lang#138278 (Delegation: fix ICE with invalid `MethodCall` generation) - rust-lang#138281 (Fix O(tests) stack usage in edition 2024 mergeable doctests) - rust-lang#138305 (Subtree update of `rust-analyzer`) - rust-lang#138306 (Revert "Use workspace lints for crates in `compiler/` rust-lang#138084") r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#137931 - xizheyin:issue-137421, r=jieyouxu Add remark for missing `llvm-tools` component re. `rustc_private` linker failures related to not finding LLVM libraries Fixes rust-lang#137421
Fixes #137421