-
-
Notifications
You must be signed in to change notification settings - Fork 18
Build fails with can't find crate for proc_macro
on musl target
#6
Comments
Here is a dockerized test: https://github.com/golddranks/proc_macro_test (run with |
I don't know much about musl but based on macros 1.1 implementation details it doesn't sound like procedural macro crates can be statically linked. It should still be possible to use a dynamically linked proc macro crate's macros from within a statically linked other crate - if not, file a Cargo issue. |
So it seems that on musl target, "normal" derive marcos as introduced in the book work without a hitch, but I think the problem is, indeed in static and dynamical linking, but actually the proc macro part seems to work fine, and the problem is the statically linked part that still links to |
The reason why
Is importing TokenStream a necessity here? I'm going to also file an issue to the Rust repo about the inability to link to |
Okay, the reason seems to be that This makes proc-macro-hack incompatible with musl unless either the dependency to proc macro in the declaration crate can be gotten rid of, or unless rustc starts supporting linking proc_macro statically. |
I released 0.3.2 with a fix. Try it out with: proc-macro-hack = { version = "0.3.2", default-features = false } Your crate is responsible for providing extern crate proc_macro;
#[macro_use]
extern crate proc_macro_hack;
proc_macro_expr_impl! {
/* ... */
} |
Tried with the
|
That looks like the error from rust-lang/rust#39889. You need to use stable 1.15 or beta 1.16 at least until tomorrow's nightly is out. See the note in the readme. |
Oops, that's right! This was an unrelated error. Reporting back in a sec. |
@dtolnay: Thanks, this works. For future reference: for the default features to be omitted, every crate linking to |
@alexcrichton made a point which made me think that not referencing |
When targeting musl (
nightly-2017-02-13
, but the stable1.15.1
fails too.), I'm encountering the following error:The text was updated successfully, but these errors were encountered: