cargo-xbuild: error: failed to get bitcode from object file for LTO
Hello. I use cargo xbuild to build my OS. Recently build failed with the following error message.
error: failed to get bitcode from object file for LTO (Bitcode section not found in object file)
My repository is this and cargo_settings.json is specified as the target. You can reproduce this by running make on the master branch. I also tried with phil-opp’s .json file, but build failed. The only thing which made it possible to build is to disable lto ( lto = false in Cargo.toml) . cargo clean && cargo xbuild did not solve the problem.
This is my CI history. You can see that the same commit succeeds and fails to build.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (20 by maintainers)
Seems like I messed something up… I can also still reproduce the error. I’ll take a look at it again right now.
Fixed version released as v0.5.31.
I created a fix at https://github.com/rust-osdev/cargo-xbuild/pull/70.
I created a minimal example to reproduce: https://github.com/toku-sa-n/cargo_bug
cargo xbuildshould cause the error.I’m currently investigating: this looks to be the culprit https://github.com/rust-lang/cargo/pull/8192.
Compiling with
rlibenabled inCargo.tomlworks, produces the following rustc flags:-Cembed-bitcode=noWith
rlibremoved we get:-C ltoManually running
rustcwith-C ltoreplaced with-C linker-plugin-ltoseems to work okay.I’ll look a bit further but that is what I’ve figured out so far.