-
Notifications
You must be signed in to change notification settings - Fork 93
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
LTO builds on recent nightlies fail "to get bitcode from object file" #292
Comments
Thanks for the heads-up! I see the cargo-xbuild issue is closed by adding |
I couldn't find any related changes for I'll try ot change |
Maybe it doesn't need anything as it builds a special-purpose libstd just for this project -- so either they'll both be LTO or neither of them are. |
Passing Interestingly, |
This commit passes `-Cembed-bitcode=yes` to rustc to work around this issue: <japaric/xargo#292>
We see build breakages over at the
For those trying to minimize the size of Rust binaries, using Xargo + LTO together is extremely important, so I'm hoping that this is able to be fixed in a way that is transparent to the end user. |
* Work around japaric/xargo#292
For those looking to work around this issue, the easiest method I found was to add [build]
# This is needed to work around: https://github.com/japaric/xargo/issues/292
rustflags = ["-Cembed-bitcode=yes"] Though this work-around will make the projects not build on stable:
|
I don't think I'll have time to work on this (and AFAIK nobody else is on it, either). I'll happily review a PR though. :) |
I mean xargo can't really be used with stable anyway, building libstd is a nightly-only feature that can only possibly be done on stable by using undocumented internal env vars that should not be used without blessing from the compiler team. |
Agreed. It's a super minor point that probably doesn't matter much. Previously some of the examples in But yeah, I don't think it's a huge deal as people can read the docs and remove |
Update: This information about Just want to keep this information up-to-date for others who stumble across this solution (thank you by the way for that). |
No, the other way around 🤣 |
We recently got a bug report for the
cargo-xbuild
project that builds with LTO fail on recent nightlies: rust-osdev#69. The error message is "error: failed to get bitcode from object file for LTO (Bitcode section not found in object file)". This also seems to affectxargo
.@toku-sa-n created a minimal example to reproduce this issue at https://github.com/toku-sa-n/cargo_bug. Just clone the project and run
xargo build --target cargo_settings
with a recent nightly to see the error.We are pretty sure that this is caused by https://github.com/rust-lang/cargo/pull/8192/files (bisect shows rustc commit rust-lang/rust#71925), but don't know what's the best way to fix this. The only thing that worked so far is to set
RUSTFLAGS
to-Clinker-plugin-lto
when compiling the sysroot, but maybe there's a better way.The text was updated successfully, but these errors were encountered: