Skip to content

cannot produce proc-macro when --target is set on musl host toolchain #7563

Closed
rust-lang/rust
#69519
@12101111

Description

@12101111

Problem

On a musl based linux system , cross compilation will fail when using proc-macro

Steps

1.Cargo.toml:

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

[dependencies]
serde= { version = "1.0", features = ["derive"] }

2.src/main.rs:

fn main(){}
$ RUSTFLAGS="-C target-feature=-crt-static" cargo build --target=wasm32-wasi
error: cannot produce proc-macro for `serde_derive v1.0.102` as the target `x86_64-unknown-linux-musl` does not support these crate types

Possible Solution(s)

Problem is : https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/build_context/target_info.rs#L406

proc-macro can't build without RUSTFLAGS=-C target-feature=-crt-static

Notes

Output of cargo version: cargo 1.40.0-nightly (5da4b4d47 2019-10-28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugO-muslOS: musl targets

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions