Skip to content

lto cannot be used for proc-macro crate type without -Zdylib-lto #3143

Closed
@marvin-hansen

Description

@marvin-hansen

The last release, 0.56, introduced a new setting for LTO (PR #3104).

However, this conflicts with the official Bzlmod LTO example and throws an error
that embed-bitcode does contain symbols for LTO. That is consistently the case on my CI.

Okay, when I enable the new LTO setting in my .bazelrc via

build --@rules_rust//rust/settings:lto=thin

bazel build throws then an error, both locally on MacOS and on CI / Linux:

error: lto cannot be used for proc-macrocrate type without-Zdylib-lto``

Indeed, I have a bunch of proc macros in my repo.

Currently, the previous LTO config throws an error and the new LTO setting also throws an error.

How do you advice to setup LTO?
Where do I set the Zdylib-lto flag?

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