Skip to content

"cannot produce proc-macro for crate as the target x86_64-unknown-linux-gnu does not support these crate types" with +crt-static #83481

@youknowone

Description

@youknowone

This issue looks like the same one but closed #78210. I am creating a new issue because I don't know if it was fixed at that time or won't be fixed or just closed by accident.

Crate code

I created an empty project with this Cargo.toml file.

[package]
name = "broken"
version = "0.1.0"
edition = "2018"

[dependencies]
async-trait = "*"

[lib]
name = "broken"
crate-type = ["staticlib", "rlib"]

And tried to build with

RUSTFLAGS="-C target-feature=+crt-static" cargo build

I expected to see this happen: successful build

Instead, this happened:

error: cannot produce proc-macro for `async-trait v0.1.48` as the target `x86_64-unknown-linux-gnu` does not support these crate types

Version it worked on

It most recently worked on: 1.48

Version with regression

It doesn't work since 1.49 only in Linux.
It still works on macOS with any rust version.

rustc --version --verbose:

rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-unknown-linux-gnu
release: 1.51.0
LLVM version: 11.0.1

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