I have been experimenting with building crates as cdylibs/staticlibs out of tree as a workaround for emulating cargo artefacts
on stable rust. I have created a repository with an example of this here. To minimally reproduce the error, run:
git clone --depth 1 https://github.com/burtonageo/rational_test_app
cd rational_test_app
cargo build --release
When building with static linking and LTO, I get the following error:
error: failed to get bitcode from object file for LTO (could not find requested section)
I have configured the release profile to use lto. When building with dynamic linking and LTO, or static linking
without LTO, the build succeeds. This can be reproduced with either lto = "thin" or lto = true. To reproduce
the error, run cargo build --release. To disable static linking, use the --no-default-features flag.
I have been experimenting with building crates as cdylibs/staticlibs out of tree as a workaround for emulating cargo artefacts on stable rust. I have created a repository with an example of this here. To minimally reproduce the error, run:
When building with static linking and LTO, I get the following error:
I have configured the
release
profile to use lto. When building with dynamic linking and LTO, or static linking without LTO, the build succeeds. This can be reproduced with eitherlto = "thin"
orlto = true
. To reproduce the error, runcargo build --release
. To disable static linking, use the--no-default-features
flag.Meta
rustc --version --verbose
:This issue is also seen on nightly:
rustc +nightly --version --verbose
: