Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upUnable to find crate `proc_macro` on musl target #40174
Comments
This comment has been minimized.
This comment has been minimized.
Yes this is currently intentional. The proc_macro crate is only a dynamic library which the musl target currently doesn't support. I unfortunately don't think this will be easy to fix... |
This comment has been minimized.
This comment has been minimized.
I understand why the proc macro crates need to be dynamic: they are loaded and run dynamically by the compiler. However what I don't understand is why the |
This comment has been minimized.
This comment has been minimized.
Is there some technical hurdle that makes it hard to do, or is it just not done because it's such a minor case? |
This comment has been minimized.
This comment has been minimized.
The simplest test for this seems to be:
build with (succeeds):
and with (fails):
When |
This comment has been minimized.
This comment has been minimized.
Okay, I did some testing. I After that, I built a After that, I copied the build artefacts from After that, I try to compile the things that failed before with musl target → it works. So, it seems that there isn't any real technical hurdles. (or if there is, I haven't encountered them yet) @alexcrichton, what do you think of distributing |
This comment has been minimized.
This comment has been minimized.
Btw. I did this work on a Linux host. Tried to do the same on macOS (with musl target of course), but on macOS the linking fails with |
This comment has been minimized.
This comment has been minimized.
Ah, okay, the |
This comment has been minimized.
This comment has been minimized.
Yes there are technical hurdles in terms of build system of doing that. This is also rarely what you want because there's no reason to have a full Rust parser linked into a binary (when it's not used). |
This comment has been minimized.
This comment has been minimized.
I see, that's a convincing argument. |
This comment has been minimized.
This comment has been minimized.
Hello,
|
Musl target does not work with proc-macro. See rust-lang/rust#40174 Removing serde-derive allows building tectonic for musl targets.
This comment has been minimized.
This comment has been minimized.
Hello! I've got this issue, as well -- deps relying on I'm currently compiling rustc for my target and it seems easiest to create |
This comment has been minimized.
This comment has been minimized.
For those following various links to this issue, it is important to note that you can compile code using
|
This comment has been minimized.
This comment has been minimized.
Reopening as this seems to still be a significant issue for people building from musl systems |
Using procedural derive macros on musl seems to work just fine for the most of the cases, but there is one pitfall; in some cases like this dtolnay/proc-macro-hack#6 build fails because not only the crate that implements the macro (crate marked with
proc-macro = true
), but also another, normal crate links to theproc_macro
crate. "Normal" crates are unable to findproc_macro
when built on musl target: