Skip to content

LTO builds on recent nightlies fail "to get bitcode from object file" #292

@phil-opp

Description

@phil-opp

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 affect xargo.

@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions