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

Add a warning when enabling LTO for crates with both cargo-types that support LTO and ones that don't. #4611

Open
Lymia opened this issue Oct 12, 2017 · 3 comments
Labels
A-crate-types Area: crate-type declaration (lib, staticlib, dylib, cdylib, etc.) A-diagnostics Area: Error and warning messages generated by Cargo itself. A-lto Area: link-time optimization S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.

Comments

@Lymia
Copy link

Lymia commented Oct 12, 2017

As discussed in #2301, cargo silently builds a cdylib without LTO when the same crate also has rlib outputs, as rustc would otherwise error.

The only sign this has happened currently is the output binaries being way larger than expected. A warning would be very helpful for this.

@alexcrichton alexcrichton added the A-diagnostics Area: Error and warning messages generated by Cargo itself. label Oct 12, 2017
@stale

This comment has been minimized.

@stale stale bot added the stale label Sep 20, 2018
@Lymia
Copy link
Author

Lymia commented Sep 20, 2018

As far as I am aware, this is still an issue.

@weihanglo
Copy link
Member

#14612 (comment) propose to emit a warning suggesting to use cargo rustc --crate-type=X, which is a flag relatively new to this old issue.

I have not yet checked how hard the warning implementation would be. Guess it won't be too hard but a bit gnarly.

@weihanglo weihanglo added S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing. and removed S-triage Status: This issue is waiting on initial triage. labels Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-crate-types Area: crate-type declaration (lib, staticlib, dylib, cdylib, etc.) A-diagnostics Area: Error and warning messages generated by Cargo itself. A-lto Area: link-time optimization S-needs-mentor Status: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.
Projects
None yet
Development

No branches or pull requests

5 participants