Skip to content
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

Bare template crashes during release build with lto = 'fat' in nightly #71

Closed
skrb-io opened this issue Dec 3, 2023 · 7 comments
Closed

Comments

@skrb-io
Copy link

skrb-io commented Dec 3, 2023

Building the rp2040 project template without any alterations with rust nightly results in an error caused by lto = 'fat' optimization

~/Documents/Projects/rp2040-nightly (main) $ cargo build --release
   Compiling rp2040-nightly v0.1.0 (/home/--/Documents/Projects/rp2040-nightly)
warning: Linking globals named '__addsf3': symbol multiply defined!

error: failed to load bitcode of module "rp2040_hal-33611457b63b1605.rp2040_hal.80f0522449fd3a4f-cgu.0.rcgu.o": 

warning: `rp2040-nightly` (bin "rp2040-nightly") generated 1 warning
error: could not compile `rp2040-nightly` (bin "rp2040-nightly") due to previous error; 1 warning emitted

It is possible that I am missing something, but changing lto = 'thin' seems to solve the issue albeit resulting in a larger binary size.

@ithinuel
Copy link
Member

ithinuel commented Dec 3, 2023

I confirm this is indeed broken on current nighly.
it might be related to rust-lang/rust#44322 but more investigation is still required at this stage.

@jannic
Copy link
Member

jannic commented Dec 3, 2023

I bisected this build error using cargo-bisect-rustc. The first bad commit was 8c2b57721728233e074db69d93517614de338055. rust-lang/rust#118559 reports a regression in that commit that matches ours well enough that I assume it's the same issue.

@ithinuel
Copy link
Member

ithinuel commented Dec 3, 2023

Indeed, and there seem to be a PR attempting to fix something relate: rust-lang/rust#118568

With a bit a luck it might be fixed in the next couple of days.

@DianQK
Copy link

DianQK commented Dec 4, 2023

Could you provide reproduction steps? I'm not sure #118568 will fix this.
Sorry, I thought this was an issue filed to rust.

@jannic
Copy link
Member

jannic commented Dec 4, 2023

Could you provide reproduction steps? I'm not sure #118568 will fix this. Sorry, I thought this was an issue filed to rust.

Still a good question:

rustup toolchain add nightly-2023-12-04 --target thumbv6m-none-eabi
git clone https://github.com/rp-rs/rp2040-project-template
cd rp2040-project-template
cargo +nightly-2023-12-04 build --target thumbv6m-none-eabi  --release
warning: Linking globals named '__addsf3': symbol multiply defined!

error: failed to load bitcode of module "rp2040_hal-33611457b63b1605.rp2040_hal.a08e78ef3bbbf4e6-cgu.0.rcgu.o": 

warning: `rp2040-project-template` (bin "rp2040-project-template") generated 1 warning
error: could not compile `rp2040-project-template` (bin "rp2040-project-template") due to 1 previous error; 1 warning emitted

@DianQK
Copy link

DianQK commented Dec 4, 2023

I can verify that rust-lang/rust#118568 did not fix the issue.
Could you please create a new issue of rust?

@ithinuel
Copy link
Member

Checked with stable, beta & nightly. This is now resolved. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants