Skip to content

lib with multiple crate types appears to override profile.release #2301

@sjudd

Description

@sjudd

I have a crate with the following in Cargo.toml:

[lib]
crate_type = ["staticlib", "rlib"]

[profile.release]
lto = true

The static library it produces is around 4.4mb.

If remove rlib:

[lib]
crate_type = ["staticlib"]

[profile.release]
lto = true

The static library is around 1.3 mb.

It seems like building both an rlib and a static lib overrides profile.release? Or at least lto?

I'm trying to build both a static lib and an rlib because I want to build both a static library and a binary for the crate and the binary depends on the library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions