-
Notifications
You must be signed in to change notification settings - Fork 483
rustc_compile_action: fix output_hash in filename #2523
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
base: main
Are you sure you want to change the base?
Conversation
What is the underlying issue that triggered your experiments? It's not the case that "experimental_use_cc_common_link" is not supported for rust_library-es; rather this feature naturally doesn't apply to them; this is already supported without having to do anything today (modulo various bugs and incompatibilities and stuff). When building individual rust_library-es, no linking happens in general (modulo dynamic libraries, etc., which let's ignore). The The outputs of the rust_library actions (.rlib-s) are compatible with both linking modes in general, hence we don't need to have the cc_commmon.link attributes on such rules. |
Long: https://bazelbuild.slack.com/archives/CSV56UT0F/p1709026282260219 In Short: Running I tried to add non-rustc linking to Nevertheless I saw that the declared object file name does not depend on the It is just a minor fix/improvement that does not change anything right now. |
Thanks!
Unfortunately this is a dead end right now: rustc adds custom load-bearing sections to proc-macros that we cannot simulate via via cc_common.link, see #2458 (comment).
Could you elaborate / provide code pointers?
|
The "bug" is this (links are to the current main branch): These two code pieces should correspond to each other: rules_rust/rust/private/rustc.bzl Line 1271 in 33860ab
rules_rust/rust/private/rustc.bzl Line 954 in 33860ab
but currently, the rustc is being told to add the hash to the filename, while at the same time bazel is told that the file will get generated by rustc without the hash in the filename. The bug only does not get triggered, because when I argue that this is pure conincidence and this precondition should either be asserted or this combination should be supported. This MR makes this a supported case. |
Thank you! There the comment above the second instance that explains this situation, which suggests that's not coincidental: rules_rust/rust/private/rustc.bzl Lines 945 to 951 in 33860ab
However it's quite convolved... so +1, adding an assert for this precondition would be great! |
I'm experimenting with
experimental_use_cc_common_link
and found this to be wrong under certain circumstances (I suspect that this codepath could never be taken, since currently only rust_binary seems to supportexperimental_use_cc_common_link
.When I try to enable
experimental_use_cc_common_link
forrust_library
and companions (adrianimboden@08cb690), the o file gets generated with the hash file in it, generating this error:when we look inside the sandbox:
this MR fixes that