-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
rustc fails to compile when -L /usr/local/lib (on Linux, at least) #20342
Comments
|
I believe the correct way to solve this is to remove the duplication entirely, but the correct way to do that is to restructure the bootstrap (#11145), which is a sizable effort. In the short term we might hack around this by blacklisting in the crate resolver the duplicate crates. |
I marked this 'easy' because the hack is not too difficult to implement. @alexcrichton what do you think of the hack? |
Another hack we might do is encode the stage number in the crate metadata and ignore crates from the wrong stage. |
I would prefer to take the route of #19941 before going through with blacklisting, I think that if cargo build scripts automatically add |
Another thing we might do is statically link all our executables, though we have some libs that are required to be dylibs. |
@alexcrichton Hm, agreed that this specific problem would be solved. It does seem to me a problem though that Rust libs can't live in the lib directory. I suspect that will bite us eventually, e.g. when distros start packaging crates themselves. |
True, in that case I'd probably prefer to encode some form of "compiler hash" into metadata. That way a compiler can reject all libraries built by other compilers (which is basically what we should do now anyway). |
I've run into this same issue in meta-rust: https://github.com/jmesmon/meta-rust/issues/6 (and it's recently caused me issues again). Causes build failures for me fairly often, as bitbake likes to rebuild things that are already installed sometimes. As I mentioned in #19767, using prioritization of paths passed to the compiler (rather than searching all of them) is an easy fix for this. Adding a "compiler hash" will not fix things for my case as I require builds to be reproducible (randomness is a problem) and in some cases will be rebuilding the same exact compiler. |
…BDIR This fixes the case where we try to re-build & re-install rust to the same prefix (without uninstalling) while using an llvm-root that is the same as the prefix. Without this, builds like that fail with: 'error: multiple dylib candidates for `std` found' See https://github.com/jmesmon/meta-rust/issues/6 for some details. May also be related to rust-lang#20342.
This fixes the case where we try to re-build & re-install rust to the same prefix (without uninstalling) while using an llvm-root that is the same as the prefix. Without this, builds like that fail with: 'error: multiple dylib candidates for `std` found' See https://github.com/jmesmon/meta-rust/issues/6 for some details. May also be related to #20342.
Still seems to be an issue. Adding |
@brson could you elaborate on what you mean by prioritization? Do you mean that if we hit multiple candidates we just pick the first one? |
@alexchricton crates loaded from later |
@brson I don't think that order (later-wins) solves things. I'd recommend searching in the order that the Of course, the complication with earlier-wins ordering is that it becomes less clear what the proper way to override things is. I haven't needed overriding in practice because I simply switch to using custom targets at that point, but it might be worth considering if there is a use case where earlier-wins doesn't completely resolve our issues. |
Hm it's certainly a possibility, yes. I've personally always found it to be a bug whenever this check trips and am generally glad it trips, but it has been annoying from time to time. |
Thanks for the correction. |
Triage: has anyone seen this since 2016? |
Triage: this is working today:
Looks like rustc_metadata now arbitrarily picks one of the two since they have the same crate hash:
|
rust-bindgen sets cargo:rustc -L to /usr/local/lib via build.rs
When this happens, linking fails because duplicate candidate dylibs are found in the bootstrap libs: (/usr/local/lib) and the rustlib (/usr/local/lib/rustlib/../lib)
Specific errors below:
The text was updated successfully, but these errors were encountered: