-
Notifications
You must be signed in to change notification settings - Fork 129
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
Build fails for STM32/ARMv7 target #444
Comments
I have also started running into the error that @tronje reports in their update, but on an imx6 build of rust-native 1.73. I can provide additional details if helpful - I just wanted to help clarify that this isn't limited to a niche build setting or target. |
I can confirm both of the above issues in imx8. 1.78 builds and works if you do a manual edit of the file usr/lib/rustlib/arm-poky-linux-gnueabi.json and rebuild libstd-rs. Changes to DATA_LAYOUT[armv7-eabi] = in rust-common.inc do not seem to take. libstd-rs builds on 1.78 after manually editing usr/lib/rustlib/arm-poky-linux-gnueabi.json in accordance with the data layout mismatch error though. |
That's interesting. There are two of these json files in my build directory, do you know which one is the one I need to change? Or simply both of them? $ fd arm-poky-linux-gnueabi.json build
build/tmp/work/x86_64-linux/rust-cross-cortexa7t2hf-neon-vfpv4-glibc/1.78.0-r0/targets/arm-poky-linux-gnueabi.json
build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/libstd-rs/1.78.0-r0/recipe-sysroot-native/usr/lib/rustlib/arm-poky-linux-gnueabi.json |
Both probably would not hurt but the latter would be my guess. It's just a problem when targeting arm. The first one would probably be a native build of the rust compiler that should run on x86_64 and produce code trgeting arm. The latter would be a build targeting arm so the file will be used in that case and cause issues for libstd-rs to build. |
Now how and why changes to DATA_LAYOUT in rust-common.inc do not take and propagate to the file arm-poky-linux-gnueabi.json I do not understand. It seems to be generated by rust_gen_target in rust-common.inc which takes the string from DATA_LAYOUT. |
Modifying the json file like this is only a temporary fix and if you delete the tmp directory and rebuild the error is back. I did lik this:
|
Yeah, I figured any change to some generated file would only be a temporary fix, but at least it would build for the time being. I'll give it a shot later today or tomorrow, probably. Thanks a lot @karlri 🙂 |
Okay, so after fixing the data-layout in So I suppose that means this requires a two part fix. diff --git a/recipes-devtools/rust/rust-common.inc b/recipes-devtools/rust/rust-common.inc
index 5196972..47a6d68 100644
--- a/recipes-devtools/rust/rust-common.inc
+++ b/recipes-devtools/rust/rust-common.inc
@@ -130,7 +130,7 @@ MAX_ATOMIC_WIDTH[arm-eabi] = "64"
FEATURES[arm-eabi] = "+v6,+vfp2"
## armv7-unknown-linux-gnueabihf
-DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
+DATA_LAYOUT[armv7-eabi] = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
LLVM_TARGET[armv7-eabi] = "${RUST_TARGET_SYS}"
TARGET_ENDIAN[armv7-eabi] = "little"
TARGET_POINTER_WIDTH[armv7-eabi] = "32" And part two is fixing whatever is causing this change to not have any effect... |
I added some simple logging to |
Akin to b93853c, update the data layout to fix the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` Fixes meta-rust#444. Note that even a rebuild of the Rust toolchain doesn't seem to make this change take effect in an existing Yocto setup. My assumption is that the rust_gen_target function is cached somehow. To fix a build that had this error previously, that function may need to be changed to trigger Yocto to actually generate the correct target JSON file, e.g. by adding a simple log statement. See issue meta-rust#444 for more information. Signed-off-by: Tronje Krabbe <[email protected]>
I removed my logging from edit: after adding logging back to Caching function output this aggressively seems weird, especially since functions have access to an environment full of a myriad of variables. Maybe I'm wrong though and it's something else? No idea what it could be, though. edit 2: of course, |
I'm guessing this is the fix: diff --git a/recipes-devtools/rust/rust-common.inc b/recipes-devtools/rust/rust-common.inc
index 47a6d68..5ec9763 100644
--- a/recipes-devtools/rust/rust-common.inc
+++ b/recipes-devtools/rust/rust-common.inc
@@ -378,4 +378,11 @@ python do_rust_gen_targets () {
addtask rust_gen_targets after do_patch before do_compile
do_rust_gen_targets[dirs] += "${WORKDIR}/targets"
-
+do_rust_gen_targets[vardeps] += "\
+ LLVM_TARGET \
+ DATA_LAYOUT \
+ MAX_ATOMIC_WIDTH \
+ TARGET_POINTER_WIDTH \
+ TARGET_C_INT_WIDTH \
+ TARGET_ENDIAN \
+" Testing this now... edit: I guess either |
Akin to b93853c, update the data layout to fix the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` Fixes meta-rust#444. Signed-off-by: Tronje Krabbe <[email protected]>
That totally makes sense, great analysis. Could it be that the same change should be made to arm-eabi aswell? |
Thanks 🙂
...so I guess so. Will add it to #446. |
This is infact reflecting - llvm/llvm-project@308e82e Change looks ok to me, however, I wonder how this descrepency was detected now and not before. alignment for function pointers was added to spec long time ago ( llvm9 ) FWIW. rust in oe-core has same problem seemingly. |
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 2d4148249534763110dc2c214dc8beb2a6e7a3b4) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 95a0f3c9f483f5c5e2268a2bb2ad5551a09762bc) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 3c47bb25bcb9f3903fb6131f138d0b29f6785fb8) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 3c47bb25bcb9f3903fb6131f138d0b29f6785fb8) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 3c47bb25bcb9f3903fb6131f138d0b29f6785fb8) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 3c47bb25bcb9f3903fb6131f138d0b29f6785fb8) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 3c47bb25bcb9f3903fb6131f138d0b29f6785fb8) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 145194fc3f50e254723bf4c115c595eacb42ce39) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 3c47bb25bcb9f3903fb6131f138d0b29f6785fb8) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 145194fc3f50e254723bf4c115c595eacb42ce39) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 802376953ed9f1b3e64b3cf57374c58d7ac68d88) Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 802376953ed9f1b3e64b3cf57374c58d7ac68d88) Signed-off-by: Tronje Krabbe <tkrabbejusst.de> Signed-off-by: Khem Raj <raj.khemgmail.com> Signed-off-by: Alexandre Belloni <alexandre.bellonibootlin.com> Signed-off-by: Richard Purdie <richard.purdielinuxfoundation.org>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 (From OE-Core rev: 802376953ed9f1b3e64b3cf57374c58d7ac68d88) Signed-off-by: Tronje Krabbe <tkrabbejusst.de> Signed-off-by: Khem Raj <raj.khemgmail.com> Signed-off-by: Alexandre Belloni <alexandre.bellonibootlin.com> Signed-off-by: Richard Purdie <richard.purdielinuxfoundation.org>
update the rust data layout to sync with LLVM [1] fixes the following build error: error: data-layout for target `arm-poky-linux-gnueabi`, `e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64`, differs from LLVM target's `armv7-unknown-linux-gnueabihf` default layout, `e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64` meta-rust issue report with rust 1.76 [2] [1] llvm/llvm-project@308e82e [2]: meta-rust/meta-rust#444 Signed-off-by: Tronje Krabbe <[email protected]> Signed-off-by: Khem Raj <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Signed-off-by: Richard Purdie <[email protected]> (adapted from oe-core commit 802376953ed9f1b3e64b3cf57374c58d7ac68d88) Signed-off-by: Scott Murray <[email protected]>
Version(s) of meta-rust
Current master, 81d0fbf
Using Rust 1.78.
Version(s) of poky and/or oe-core
kirkstone-4.0.17, commit 6d1a878bbf24c66f7186b270f823fcdf82e35383
Expected result
The
rust-hello-world
recipe builds successfullyActual result
Trying to build
rust-hello-world
does not actually reach trying to build that recipe. Instead, buildinglibstd-rs
fails.Abbreviated error output:
Basically the data-layout is different between Rust's and LLVM's, I guess...?
Steps to reproduce
I'm targeting a machine that uses an STM32MP1. Board support, etc. is from here: https://github.com/karo-electronics/meta-karo
I guess try to build
rust-hello-world
with currentmeta-rust
for a machine that uses the armv7-eabi data layout...Additional information
Building the
rust-hello-world
recipe works fine with my Poky's version of Rust, and that, curiously, has the sameDATA_LAYOUT
set asmeta-rust
. I thought maybe the difference in version ofrust-llvm
might be the issue, but as far as I can tell, both versions ofrust-llvm
use the same data layout, too. I tried simply pasting the LLVM data layout from the error message intorust-common.inc
, but to no avail. I did abitbake -c cleanall rust-native rust-llvm-native
, but that did not help, either..I did notice b93853c which fixes basically the same issue but for x86.
Any help is appreciated, thanks!
Update
I should have mentioned that all this happened while trying to build with Rust 1.78.0. I've added that information above.
I tried using Rust 1.75.0, and that fails at a different stage:
The above error occurs while trying to build rust-native.
The text was updated successfully, but these errors were encountered: