-
Notifications
You must be signed in to change notification settings - Fork 125
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
aarch64: can't find crate for proc_macro
` when compiling proc-macro2
#266
Comments
after some testing it's clear that I'm able to find it on my host standalone cargo toolchain install for the same target. I dont know why meta-rust when setting up the toolchain is not generating this file. |
I've been looking at this layer lately, and ran across a similar problem. The quickest, but maybe not most correct fix is to change meta-rust/recipes-devtools/rust/libstd-rs.inc: from: to: Building libtest will actually build both libtest and libstd, and also includes libproc_macro. |
I'm hitting this with a few commits back on master
libstd-rs is only building native version of proc_macro
Can anyone suggest another workaround? |
I'm encountering this issue while building a Rust project for aarch64. The project is based on the Rocket web server, v0.5-rc. I had no problems until I added the crate I'm currently using meta-rust 448047c. |
Now that rust support is in OE core I need to test with updated branch. I suspect the issue is still there. |
I'm comparing my Yocto The local rustup dir has these that are not in the Yocto poky dir:
Why are these ones in the rustup dir but not in the Yocto poky dir? |
I suspect the build breaks at the missing libproc_macro, and never gets to the others. If you look at the source proc_macro has it's own directory, and is the exception. In my case what's odd is that it's attempting to link a cross compiled libproc_macro. Libproc_macro should only ever be host. |
Did you try setting LD_LIBRARY RUNTIME to path in sysroot-native that has proc_macro? Given proc_macros are only built/run on host, LD_LIBRARY_RUNTIME can be used to augment paths from sysroot-native. |
@jwinarske wrote:
and also
I don't think this is correct. For non-Yocto builds, I installed the I tested this:
So, I think your hypothesis is incorrect, and the Yocto |
@cmcqueen What's the machine architecture of libproc_macro-3f1222cb41e97635.rlib? |
|
@cmcqueen Is this a public project you can share? |
No, it's private for my employer. But, I'll see if I can make a "Minimal Reproducible Example" (MRE). |
Here's a minimal example:
I think it's the |
-S = "${RUSTSRC}/library/std"
+S = "${RUSTSRC}/library/test" That can be done in a |
@cmcqueen You example builds fine on desktop for host (x86_64), but fails cross compiling on Desktop for aarch64. I would suggest that needs to be addressed prior to attempting to build for Yocto...
When I reported changing S not having an impact was with 1.45, and in my case the problem was addressing runtime dependency problems (CXX binding nonsense). |
@jwinarske I didn't encounter |
|
Sorry, I'm at a loss to explain the |
To cross-compile
You also need to create a file
|
@jwinarske have you been able to investigate this further? With my previous comment, you should be able to manually cross-compile for the aarch64 target, I think. |
@cmcqueen not yet. I've been working around it via Yocto SDK and Rust cross Canadian toolchain. I will be looking at this in ~three weeks. |
@cmcqueen I took a look at this today. Using bbappend fixes the issue.
|
Have this been fixed? |
@otavio The only way to work around this is to add listed-rs_%.bbappend as I indicate above. This should get an official fix, as this is a work around. |
@otavio Still present in poky at current master 44bb88cc869f3b42440d6f7aad000e706b739a2b building for raspberrypi4-64; overriding libstd-rs as described in #266 (comment) still fixes it. rust-lang/rustc-dev-guide#1389 seems to identify the root cause of the problem, and changing |
@otavio This is my solution for now: |
Building libstd-rs from library/std omits proc_macro from the sysroot. Using library/test causes that to be installed which then allows cargo to build (meta-rust#266) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
Building libstd-rs from library/std omits proc_macro from the sysroot. Using library/test causes that to be installed which then allows cargo to build (meta-rust/meta-rust#266) (From OE-Core rev: 62527d5dadb79c70731e1dfd7b1f71495c78b267) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Building libstd-rs from library/std omits proc_macro from the sysroot. Using library/test causes that to be installed which then allows cargo to build (meta-rust/meta-rust#266) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Building libstd-rs from library/std omits proc_macro from the sysroot. Using library/test causes that to be installed which then allows cargo to build (meta-rust/meta-rust#266) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Building libstd-rs from library/std omits proc_macro from the sysroot. Using library/test causes that to be installed which then allows cargo to build (meta-rust#266) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Building libstd-rs from library/std omits proc_macro from the sysroot. Using library/test causes that to be installed which then allows cargo to build (meta-rust/meta-rust#266) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Is it just me, or does 1.71+ break the accepted workaround for this issue? |
Same problem with 1.72. Changing
removing panic-unwind and backtrace features shows different errors |
Is there any fix for this issue on 1.72? |
-removes workaround for `can't find crate for proc_macro` when compiling proc-macro2` -meta-rust/meta-rust#266 -#370 Signed-off-by: Joel Winarske <joel.winarske@gmail.com>
To everyone still stuck with this, or those who come here from a search result, an answer has been posted in #425 (comment) |
@jaskij What versions have you tested that with? Also not sure if this repo is used verbatim in Yocto. |
That said I only use this repo for dunfell |
@jwinarske 1.75, kirkstone, but I'm doing x86-64 -> x86-64 so there may be some host contamination that slipped by. So far the only thing I have confirmed is a successful build. |
Building libstd-rs from library/std omits proc_macro from the sysroot. Using library/test causes that to be installed which then allows cargo to build (meta-rust/meta-rust#266) Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
the recommended fix in this thread is broken in 1.78.0 causing the error:
the fix can be adjusted with modification per this issue: -S = "${RUSTSRC}/library/test"
+S = "${RUSTSRC}/library/sysroot" |
Version(s) of meta-rust
Master (d0dc19a)
Version(s) of poky and/or oe-core
poky: (Sep 8 2019) 6d2e12e79211b31cdf5ea824fb9a8be54ba9a9eb
Expected result
Using cargo only im able to successfully cross-compile and run my code on the target
aarch64-unknown-linux-gnu
.Using Yocto and meta-rust the build fails with
error[E0463]: can't find crate for
proc_macro`` when compiling proc-macro2.any idea ?
thank you
Actual result
Steps to reproduce
The text was updated successfully, but these errors were encountered: