Skip to content

"target doesn't support these crate types" error on x86_64-unknown-linux-musl host #7154

@ghost

Description

Problem

I'm trying to build an library with proc-macro for x86_64-unknown-linux-musl target.

When the host is x86_64-unknown-linux-gnu it can be compiled successfully.

However, when the host is x86_64-unknown-linux-gnu, Cargo outputs this error:

error: cannot produce proc-macro for `proc_macro_lib v0.1.0 (/proc-macro-lib)` as the target `x86_64-unknown-linux-musl` does not support these crate types

As I understand, there should be no difference, as the target is the same and no C libraries from the host are used.

Steps

I've created this repository to reproduce the problem using Docker.

Running

docker-compose up --build host-gnu

runs cargo build for a library with proc-macro = true with host x86_64-unknown-linux-gnu and target x86_64-unknown-linux-musl, it builds the library successfully.

However, running

docker-compose up --build host-must

outputs the error mentioned above.
Notes

Output of cargo version:

cargo 1.36.0 (c4fcfb725 2019-05-15)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions