-
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
regression: multiple definitions of function #123289
Comments
The change bisects to #122233. I think there's a CGU partitioning that causes the build to successfully link, and that PR perturbed enough code to alter how CGUs get merged. The crate still builds on nightly and on stable if you set |
@estebank fresh example of where it would be great to have better linker diagnostics |
Sounds good. I think there's no true regression here in that case, dropping various labels and I suspect we can just close (will do that unless we want to track it as diagnostics, but doesn't seem worth it to me) |
Esteban was musing about writing better linker diagnostics, and now that I've assigned myself to this I'll be better able to find it if I do cook up something later. I agree this is better closed. |
@saethlin keep me posted on whatever ticket for the diagnostics part of this you create, so I can help. |
Would using |
I tried building [email protected] with
And I don't get a linker error. Even with that flag there seems to be a CGU threshold that makes the linker accept the inputs. |
rust/compiler/rustc_codegen_ssa/src/back/link.rs Lines 2310 to 2313 in 3d5528c
--whole-archive is a position-dependent linker argument. It applies to all archives after --whole-archive until the next --no-whole-archive . You did have to use -Zpre-link-arg and check that rustc doesn't emit any --no-whole-archive to reset a --whole-archive it emitted for a single staticlib. Or you need to modify rustc directly and change the false here to a true : rust/compiler/rustc_codegen_ssa/src/back/link.rs Line 2837 in 3d5528c
|
If I modify the compiler as you described I can indeed get the multiple definition error regardless of CGUs. I can't build anything at all with that
|
I just got hit by this issue. Project built and ran with no issue with rust 1.77.2, and now fails to link with rust 1.78.0:
Looking at the cargo tree output, it's obvious that the duplicate wgpu versions might not be what I want. Indirect dep is being bumped, but not ready yet. I'm not sure if this warrants a separate issue, but this is definitely an unexpected regression. I'll leave it as-is because the fix is trivial on my side (just use older wgpu version aligned with pixels'). |
Since rust 1.78.0, we have a linker error because of the different wgpu versions in the dependency tree: rust-lang/rust#123289 This worksaround this issue, and should also be more correct, because we might not want to have different wgpus in parallel.
Since rust 1.78.0, we have a linker error because of the different wgpu versions in the dependency tree: rust-lang/rust#123289 This worksaround this issue, and should also be more correct, because we might not want to have different wgpus in parallel.
This is an equivalent situation; on your project's commit |
The text was updated successfully, but these errors were encountered: