Closed hhy50 closed 3 hours ago
What do you expect? You are declaring a proc-macro library. These run on the host.
[[bin]]
name = "billiards_esp32"
harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors
[lib]
proc-macro = true
but, I also have a bin crate
It does not work like that. You are chasing rust restrictions, misinterpreting the error and then opening as bug here. What IDG_TARGET
? Look at the error output.
Error: Unsupported target 'x86_64-apple-darwin'
It is rustc and cargo themselves who are not picking your esp32 target, not esp-idf-sys
. You are compiling for the host.
It does not work like that. You are chasing rust restrictions, misinterpreting the error and then opening as bug here. What
IDG_TARGET
? Look at the error output.Error: Unsupported target 'x86_64-apple-darwin'
It is rustc and cargo themselves who are not picking your esp32 target, not
esp-idf-sys
. You are compiling for the host.
[lib]
proc-macro = true
The target is specified in. cargo/config Without this, it can operate normally
@ivmarkov You can find an example project and try adding it
OK I give it one last try: what you are trying to do (mixing a proc-macro crate together in another, non-proc-macro crate) is just NOT possible in Rust.
This is not a problem of esp-idf-sys
.
This is a restriction of Rust. And if you think about it, it does make sense!
Try to do what you are trying to do with any other embedded framework - be it esp-hal
or embassy
and you'll see it is simply impossible.
The only solution is to have your proc-macros in a separate, dedicated proc-macro crate. As everybody else does. Google the internet for that.
OK I give it one last try: what you are trying to do (mixing a proc-macro crate together in another, non-proc-macro crate) is just NOT possible in Rust.
This is not a problem of
esp-idf-sys
. This is a restriction of Rust. And if you think about it, it does make sense!Try to do what you are trying to do with any other embedded framework - be it
esp-hal
orembassy
and you'll see it is simply impossible.The only solution is to have your proc-macros in a separate, dedicated proc-macro crate. As everybody else does. Google the internet for that.
Thank you very much for your patient answer, I have now placed it in a separate crate
After adding this parameter to Cargo.toml, the build failed
build log: