cargo: can't specify lto in profile on specific packages
Problem
Cargo doesn’t accept lto in profile as below:
[profile.release.package.fluvio-filter-test]
lto = true
Steps This result in following error message:
$ cargo check
error: failed to parse manifest at `/home/ubuntu/fluvio/Cargo.toml`
Caused by:
`lto` may not be specified in a `package` profile
$ cargo version
cargo 1.51.0 (43b129a20 2021-03-16)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 12
- Comments: 20 (11 by maintainers)
I think this may be worth leaving open to track a way to do this using the
releaseprofile, without workarounds.I’m experiencing this same issue. Would love a way around this.
@ehuss
Yes, multiple executables, they can easily need different build settings. In general, crates in the build tree aren’t necessarily built together into the same binary.
I encountered the same issue, but with
panicinstead ofltoThe worst thing is that there’s no reasonable workaround for this (or at least I haven’t found one).
Since its not mentioned, the workaround for this is to define different profiles and build the different binaries with the relevant profiles.
Same issue here.
Is this being taken care of?
I’m having the same issue. Of many packages and crates in the workspace, I was hoping some specific crates to be compiled with different settings. Specifying
profilein the non-root package caused warnings hence I put those in the workspace which throws out errors.Looks like it’s possible to make a separate profile that inherits from the main one, but overrides panic or lto. Then the specific package will always be built with that profile.
Ugh, looks like different executables may share built dependencies, which is obviously good, but will prevent overriding things like
panic. I guess it’s hard for cargo to setup some mini-equivalent of profiles to build dependencies with differentpanicvalues separately while keeping everything in a single workspace?