@@ -51,7 +51,7 @@ def rust_base_triple(d, thing):
if d.getVar('{}_ARCH'.format(thing)) == d.getVar('TARGET_ARCH') and target_is_armv7(d):
arch = "armv7"
else:
- arch = oe.rust.arch_to_rust_arch(d.getVar('{}_ARCH'.format(thing)))
+ arch = mixin.rust.arch_to_rust_arch(d.getVar('{}_ARCH'.format(thing)))
# Substituting "unknown" when vendor is empty will match rust's standard
# targets when building native recipes (including rust-native itself)
@@ -77,7 +77,7 @@ def rust_base_triple(d, thing):
# In some cases uname and the toolchain differ on their idea of the arch name
-RUST_BUILD_ARCH = "${@oe.rust.arch_to_rust_arch(d.getVar('BUILD_ARCH'))}"
+RUST_BUILD_ARCH = "${@mixin.rust.arch_to_rust_arch(d.getVar('BUILD_ARCH'))}"
# Naming explanation
# Yocto
@@ -343,7 +343,7 @@ def rust_gen_target(d, thing, wd, arch):
if arch == "arm" and target_is_armv7(d):
arch = 'armv7'
- rust_arch = oe.rust.arch_to_rust_arch(arch)
+ rust_arch = mixin.rust.arch_to_rust_arch(arch)
if abi:
arch_abi = "{}-{}".format(rust_arch, abi)
@@ -23,3 +23,7 @@ BBMASK:append = " meta/recipes-devtools/cargo/ meta/recipes-devtools/rust/ meta/
# These are in bitbake.conf in langdale and up, adding them here to make
# using the layer more turn-key seems reasonable.
BB_BASEHASH_IGNORE_VARS:append = " RUST_BUILD_SYS RUST_HOST_SYS RUST_TARGET_SYS"
+
+# Since we cannot overlay the lib/oe version easily, make sure our backport
+# of rust.py in lib/mixin is picked up.
+OE_EXTRA_IMPORTS:append = " mixin.rust"
new file mode 100644
@@ -0,0 +1,13 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+# Handle mismatches between `uname -m`-style output and Rust's arch names
+def arch_to_rust_arch(arch):
+ if arch == "ppc64le":
+ return "powerpc64le"
+ if arch in ('riscv32', 'riscv64'):
+ return arch + 'gc'
+ return arch
Building Rust projects for RISC-V platforms was failing due to the layer not including a copy of lib/oe/rust.py to get all the changes from oe-core commit 1cfb9c8a ("rust-target-config: match riscv target names with what rust expects"). Reverting the changes from that commit seems likely to make things less robust, so instead add a copy of the updated lib/oe/rust.py in lib/mixin and update callers of arch_to_rust_arch to use it. This is not ideal from an ease of further maintenance perspective, but seems more inline with the intent of matching the behavior of the Rust toolchain as it stands in Mickledore branch. Signed-off-by: Scott Murray <scott.murray@konsulko.com> --- classes/rust-common.bbclass | 4 ++-- classes/rust-target-config.bbclass | 2 +- conf/layer.conf | 4 ++++ lib/mixin/rust.py | 13 +++++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 lib/mixin/rust.py