Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: cannot produce proc-macro for clap_derive v3.0.0-beta.1 as the target x86_64-unknown-linux-musl does not support these crate types #1938

Closed
2 tasks done
mrusme opened this issue May 21, 2020 · 4 comments
Assignees
Labels
C-bug Category: Updating dependencies

Comments

@mrusme
Copy link

mrusme commented May 21, 2020

Make sure you completed the following tasks

Code

Here.

Steps to reproduce the issue

Here.

Version

Environment: 1.43.1-alpine3.11
Clap: 3.0.0-beta.1

Actual Behavior Summary

error: cannot produce proc-macro for 'clap_derive v3.0.0-beta.1' as the target 'x86_64-unknown-linux-musl' does not support these crate types

Expected Behavior Summary

Build should be successful.

Additional context

Alpine Linux, official Rust image.

Debug output

Here.

@mrusme mrusme added the C-bug Category: Updating dependencies label May 21, 2020
@pksunkara
Copy link
Member

@CreepySkeleton
Copy link
Contributor

CreepySkeleton commented May 21, 2020

@mrusme As a general rule, please avoid linking to someone's github.com/<user>/<repo>/master because master (and other tags/branches) are not permalinks. You push a new commit, and the link now points to another piece of code.

Ideally, you should copy-paste the relevant code into the issue. If you think that the code sample is too large, you can use permalinks:

image


As regards to the issue, this is a bug in rustc. The fix is already merged and will be released in 1.44.0.

The temporary workaround is to use this

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

instead of cargo build.

Or if you don't need the derive (and it looks like you don't), you can just switch it off with:

# Cargo.toml
[dependencies]
clap = { git = "...", default-features = false, features = ["std"] }

@mrusme
Copy link
Author

mrusme commented May 21, 2020

@CreepySkeleton thank you, Sir!

@CreepySkeleton
Copy link
Contributor

I'm a Sir, yay!

mrusme pushed a commit to mrusme/cmdr that referenced this issue May 21, 2020
As pointed out here: clap-rs/clap#1938
genshen added a commit to misa-md/md-tools that referenced this issue Feb 27, 2021
… for static linking

as descripted in clap-rs/clap#1938, following error can be resolved by using
`RUSTFLAGS="-C target-feature=-crt-static"` or disable `derive` feature.
In fact, we don't need the derive feature. Thus, it can be disabled.

Error message when add rust flag `+crt-static` only for static linking:
`cannot produce proc-macro for `clap_derive v3.0.0-beta.2` as the target `x86_64-unknown-linux-gnu` does not support these crate types`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Updating dependencies
Projects
None yet
Development

No branches or pull requests

3 participants