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

LTO does not work due to default rlib target, causing extremely large static build artifacts #322

Closed
Humandoodlebug opened this issue May 22, 2023 · 6 comments · Fixed by #323

Comments

@Humandoodlebug
Copy link

In order to fix #138, CrateType::Lib is always selected when building (see here). Unfortunately, this means LTO configuration is ignored (see this cargo issue), meaning our gstreamer plugins are ridiculously large, especially for static builds (hundreds of megabytes when they should be less than ten).

Reverting 596c582 does fix it, however this would probably break #138.

@sdroege
Copy link
Sponsor Contributor

sdroege commented May 22, 2023

Thanks for finding this. I've added that also to the GStreamer Rust tracker issue.

Would it be possible to only build the rlib when the test target is selected? cargo-c should know that, right?

@lu-zero
Copy link
Owner

lu-zero commented May 22, 2023

Yes and yes, thank you for debugging it :)

@sdroege
Copy link
Sponsor Contributor

sdroege commented May 22, 2023

@Humandoodlebug When statically linking multiple LTO'd GStreamer Rust plugins, are you not running into rust-lang/rust#44322 (comment) ?

@lu-zero
Copy link
Owner

lu-zero commented May 22, 2023

One annoyance is that it might again require rebuilding everything twice.

@lu-zero
Copy link
Owner

lu-zero commented May 22, 2023

The upstream open issue is rust-lang/cargo#4611

lu-zero added a commit that referenced this issue May 22, 2023
This reverts commit 596c582.

It should fix #322.
lu-zero added a commit that referenced this issue May 22, 2023
This reverts commit 596c582.

Fixes #322.
lu-zero added a commit that referenced this issue May 22, 2023
This reverts commit 596c582.

Fixes #322.
@Humandoodlebug
Copy link
Author

Thank you for fixing this so quickly :)
@sdroege we haven't hit that yet, but we almost certainly will soon - thanks for the heads up.

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

Successfully merging a pull request may close this issue.

3 participants