-
Notifications
You must be signed in to change notification settings - Fork 480
Linking errors with LTO on Ubuntu 24.04 and rules_rust 0.60.0 #3409
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
Comments
Got me:
|
with this:
I get further but then one of the workspace crates fails without any obvious rustc errors (yes, I used verbose_failures and sandbox_debug), just says the object file is missing:
|
Got it to build with this, but no LTO. |
My experience is that, that this error is happening when the local LLVM (lld) version which is used for linking is not compatible with the LLVM version used in the rustc. That is the indication of the error. However, you said that even using llvm 19 based lld is not working? |
I've uninstalled llvm-18 and it's still happening somehow. It looks like it's trying to use |
Potentially relevant thread: rust-lang/rust#49879 (comment) |
This combination worked on the Linux CI/CD instance, but I need to make
|
You can use platform-specific config feature in .bazelrc or create your own toolchain. https://bazel.build/run/bazelrc#enable_platform_specific_config |
Yes, thank you. I already had it I just wasn't leveraging it yet, here's the final version:
Hopefully this saves someone else time. I installed Is there a way for rules_rust to know when to do this automatically? Cargo seems to do this automatically. |
I think cargo won't necessarily enable linker-plugin-lto as it is not really needed when linking done by rustc. It doesn't give you too much benefit as far as we found out in our project. Unless you really need cross-language lto |
.bazelrc
:MODULE.bazel
:on an Ubuntu 24.04 machine with LLVM 18 and 19 installed yields this error:
Trying to set it to rust-lld expressly for linux:
yields this error:
Then I tried:
which got me:
The text was updated successfully, but these errors were encountered: