All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/8] rust: Fix powerpc64le support
@ 2022-02-22  3:52 Andrew Jeffery
  2022-02-22  3:52 ` [RFC PATCH 1/8] rust: Migrate arch_to_rust_target_arch() to rust-common class Andrew Jeffery
                   ` (7 more replies)
  0 siblings, 8 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22  3:52 UTC (permalink / raw)
  To: openembedded-core

Hello,

This series was motivated by some CI failures we saw in OpenBMC on our
ppc64le build machines, driven by the python3-cryptography dependency of
the tpm2-pkcs11 package, pulled in via packagegroup-security-tpm2.

I previously sent an initial, wildly insufficient attempt that fixed the
immediate error of using a bad architecture name in the snapshot
download URLs:

https://lore.kernel.org/openembedded-core/20220218054315.169005-1-andrew@aj.id.au/

Khem was on the money with his query, and pulling that thread led
to this unwieldy series. Together these patches (plus another for
meta-openembedded to fix CARGO_BUILD_TARGET) result in a successful
`bitbake python3-cryptography` targetting an ARMv7 machine (an ASPEED
AST2600 BMC SoC) on ppc64le and x86-64.

Please treat the patches with suspicion, I really just slashed my way
through it all until the build didn't fail, then tried to clean the
result up into a series that might be reviewable. Hence RFC.

Anyway, please take a look!

Andrew

Andrew Jeffery (8):
  rust: Migrate arch_to_rust_target_arch() to rust-common class
  rust: Rename arch_to_rust_target_arch() for generality
  rust: Handle Power arch variants in arch_to_rust_arch()
  rust: Consistently use RUST_{BUILD,HOST,TARGET}_{ARCH,SYS}
  rust: libstd-rs: Install deps under {RUST_,}TARGET_SYS mismatch
  rust: Mitigate duplicate sections on matching architectures
  rust: Add snapshot checksums for powerpc64le
  rust: Introduce RUST_BUILD_ARCH

 meta/classes/cargo.bbclass                    |  4 +-
 meta/classes/cargo_common.bbclass             |  6 +--
 meta/classes/rust-common.bbclass              | 23 ++++++++++-
 meta/classes/rust.bbclass                     |  8 ++--
 meta/recipes-devtools/rust/libstd-rs.inc      | 12 +++++-
 meta/recipes-devtools/rust/rust-common.inc    | 29 ++++----------
 .../rust/rust-cross-canadian-common.inc       |  6 +--
 .../rust/rust-cross-canadian.inc              | 23 +++++------
 meta/recipes-devtools/rust/rust-cross.inc     |  2 +-
 meta/recipes-devtools/rust/rust-snapshot.inc  | 16 +++++---
 meta/recipes-devtools/rust/rust.inc           | 38 ++++++++++---------
 11 files changed, 96 insertions(+), 71 deletions(-)

-- 
2.32.0



^ permalink raw reply	[flat|nested] 26+ messages in thread

* [RFC PATCH 1/8] rust: Migrate arch_to_rust_target_arch() to rust-common class
  2022-02-22  3:52 [RFC PATCH 0/8] rust: Fix powerpc64le support Andrew Jeffery
@ 2022-02-22  3:52 ` Andrew Jeffery
  2022-02-22 10:05   ` [OE-core] " Richard Purdie
  2022-02-22  3:52 ` [RFC PATCH 2/8] rust: Rename arch_to_rust_target_arch() for generality Andrew Jeffery
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22  3:52 UTC (permalink / raw)
  To: openembedded-core

This will allow us to use it elsewhere for architecture name
translation. This move is motivated by powerpc64le support.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 meta/classes/rust-common.bbclass           | 16 ++++++++++++++++
 meta/recipes-devtools/rust/rust-common.inc | 16 ----------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
index 98d65970e8c0..2f2a31867ad0 100644
--- a/meta/classes/rust-common.bbclass
+++ b/meta/classes/rust-common.bbclass
@@ -1,5 +1,21 @@
 inherit python3native
 
+# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something
+# rust's internals won't choke on.
+def arch_to_rust_target_arch(arch):
+    if arch == "i586" or arch == "i686":
+        return "x86"
+    elif arch == "mipsel":
+        return "mips"
+    elif arch == "mip64sel":
+        return "mips64"
+    elif arch == "armv7":
+        return "arm"
+    elif arch == "powerpc64le":
+        return "powerpc64"
+    else:
+        return arch
+
 # Common variables used by all Rust builds
 export rustlibdir = "${libdir}/rust"
 FILES:${PN} += "${rustlibdir}/*.so"
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index ceeee9786376..742933f1bd22 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -254,22 +254,6 @@ def sys_for(d, thing):
 def prefix_for(d, thing):
     return d.getVar('{}_PREFIX'.format(thing))
 
-# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something
-# rust's internals won't choke on.
-def arch_to_rust_target_arch(arch):
-    if arch == "i586" or arch == "i686":
-        return "x86"
-    elif arch == "mipsel":
-        return "mips"
-    elif arch == "mip64sel":
-        return "mips64"
-    elif arch == "armv7":
-        return "arm"
-    elif arch == "powerpc64le":
-        return "powerpc64"
-    else:
-        return arch
-
 # generates our target CPU value
 def llvm_cpu(d):
     cpu = d.getVar('PACKAGE_ARCH')
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 2/8] rust: Rename arch_to_rust_target_arch() for generality
  2022-02-22  3:52 [RFC PATCH 0/8] rust: Fix powerpc64le support Andrew Jeffery
  2022-02-22  3:52 ` [RFC PATCH 1/8] rust: Migrate arch_to_rust_target_arch() to rust-common class Andrew Jeffery
@ 2022-02-22  3:52 ` Andrew Jeffery
  2022-02-22  3:52 ` [RFC PATCH 3/8] rust: Handle Power arch variants in arch_to_rust_arch() Andrew Jeffery
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22  3:52 UTC (permalink / raw)
  To: openembedded-core

It's not just for translating TARGET names, but any of BUILD, HOST or
TARGET.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 meta/classes/rust-common.bbclass           | 2 +-
 meta/recipes-devtools/rust/rust-common.inc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
index 2f2a31867ad0..e50d606ce26f 100644
--- a/meta/classes/rust-common.bbclass
+++ b/meta/classes/rust-common.bbclass
@@ -2,7 +2,7 @@ inherit python3native
 
 # Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something
 # rust's internals won't choke on.
-def arch_to_rust_target_arch(arch):
+def arch_to_rust_arch(arch):
     if arch == "i586" or arch == "i686":
         return "x86"
     elif arch == "mipsel":
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index 742933f1bd22..c36d836fcf41 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -313,7 +313,7 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""):
     tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi)
     tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi)
     tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi)
-    tspec['arch'] = arch_to_rust_target_arch(arch)
+    tspec['arch'] = arch_to_rust_arch(arch)
     tspec['os'] = "linux"
     if "musl" in tspec['llvm-target']:
         tspec['env'] = "musl"
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 3/8] rust: Handle Power arch variants in arch_to_rust_arch()
  2022-02-22  3:52 [RFC PATCH 0/8] rust: Fix powerpc64le support Andrew Jeffery
  2022-02-22  3:52 ` [RFC PATCH 1/8] rust: Migrate arch_to_rust_target_arch() to rust-common class Andrew Jeffery
  2022-02-22  3:52 ` [RFC PATCH 2/8] rust: Rename arch_to_rust_target_arch() for generality Andrew Jeffery
@ 2022-02-22  3:52 ` Andrew Jeffery
  2022-02-22  3:52 ` [RFC PATCH 4/8] rust: Consistently use RUST_{BUILD,HOST,TARGET}_{ARCH,SYS} Andrew Jeffery
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22  3:52 UTC (permalink / raw)
  To: openembedded-core

Modern Power ecosystems can be either BE or LE, so handle both. Further,
rust understands these as "powerpc64" and "powerpc64le" respectively.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 meta/classes/rust-common.bbclass           | 4 +++-
 meta/recipes-devtools/rust/rust-common.inc | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
index e50d606ce26f..3c7d133f0445 100644
--- a/meta/classes/rust-common.bbclass
+++ b/meta/classes/rust-common.bbclass
@@ -11,8 +11,10 @@ def arch_to_rust_arch(arch):
         return "mips64"
     elif arch == "armv7":
         return "arm"
-    elif arch == "powerpc64le":
+    elif arch == "ppc64":
         return "powerpc64"
+    elif arch == "ppc64le":
+        return "powerpc64le"
     else:
         return arch
 
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index c36d836fcf41..4b758260d276 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -265,7 +265,8 @@ def llvm_cpu(d):
     trans['x86-64'] = "x86-64"
     trans['i686'] = "i686"
     trans['i586'] = "i586"
-    trans['powerpc'] = "powerpc"
+    trans['powerpc64'] = "powerpc"
+    trans['powerpc64le'] = "powerpc"
     trans['mips64'] = "mips64"
     trans['mips64el'] = "mips64"
     trans['riscv64'] = "generic-rv64"
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 4/8] rust: Consistently use RUST_{BUILD,HOST,TARGET}_{ARCH,SYS}
  2022-02-22  3:52 [RFC PATCH 0/8] rust: Fix powerpc64le support Andrew Jeffery
                   ` (2 preceding siblings ...)
  2022-02-22  3:52 ` [RFC PATCH 3/8] rust: Handle Power arch variants in arch_to_rust_arch() Andrew Jeffery
@ 2022-02-22  3:52 ` Andrew Jeffery
  2022-02-22  3:52 ` [RFC PATCH 5/8] rust: libstd-rs: Install deps under {RUST_,}TARGET_SYS mismatch Andrew Jeffery
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22  3:52 UTC (permalink / raw)
  To: openembedded-core

With achitecture name translation, the RUST_-prefixed variables and
their unadorned equivalents may not be the same.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 meta/classes/cargo.bbclass                    |  4 ++--
 meta/classes/cargo_common.bbclass             |  6 ++---
 meta/classes/rust-common.bbclass              |  2 +-
 meta/classes/rust.bbclass                     |  8 +++----
 meta/recipes-devtools/rust/rust-common.inc    | 10 ++++----
 .../rust/rust-cross-canadian-common.inc       |  6 ++---
 .../rust/rust-cross-canadian.inc              | 23 ++++++++++---------
 meta/recipes-devtools/rust/rust-cross.inc     |  2 +-
 meta/recipes-devtools/rust/rust.inc           | 16 ++++++-------
 9 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/meta/classes/cargo.bbclass b/meta/classes/cargo.bbclass
index 0ca38143c0b3..1507ff0e4ca1 100644
--- a/meta/classes/cargo.bbclass
+++ b/meta/classes/cargo.bbclass
@@ -31,12 +31,12 @@ MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
 
 RUSTFLAGS ??= ""
 BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} ${BUILD_MODE} --manifest-path=${MANIFEST_PATH}"
+CARGO_BUILD_FLAGS = "-v --target ${RUST_HOST_SYS} ${BUILD_MODE} --manifest-path=${MANIFEST_PATH}"
 
 # This is based on the content of CARGO_BUILD_FLAGS and generally will need to
 # change if CARGO_BUILD_FLAGS changes.
 BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_TARGET_SUBDIR="${HOST_SYS}/${BUILD_DIR}"
+CARGO_TARGET_SUBDIR="${RUST_HOST_SYS}/${BUILD_DIR}"
 oe_cargo_build () {
 	export RUSTFLAGS="${RUSTFLAGS}"
 	export RUST_TARGET_PATH="${RUST_TARGET_PATH}"
diff --git a/meta/classes/cargo_common.bbclass b/meta/classes/cargo_common.bbclass
index 90fad7541530..103240ce491e 100644
--- a/meta/classes/cargo_common.bbclass
+++ b/meta/classes/cargo_common.bbclass
@@ -69,15 +69,15 @@ cargo_common_do_configure () {
 	cat <<- EOF >> ${CARGO_HOME}/config
 
 	# HOST_SYS
-	[target.${HOST_SYS}]
+	[target.${RUST_HOST_SYS}]
 	linker = "${CARGO_RUST_TARGET_CCLD}"
 	EOF
 
-	if [ "${HOST_SYS}" != "${BUILD_SYS}" ]; then
+	if [ "${RUST_HOST_SYS}" != "${RUST_BUILD_SYS}" ]; then
 		cat <<- EOF >> ${CARGO_HOME}/config
 
 		# BUILD_SYS
-		[target.${BUILD_SYS}]
+		[target.${RUST_BUILD_SYS}]
 		linker = "${RUST_BUILD_CCLD}"
 		EOF
 	fi
diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
index 3c7d133f0445..58ece01097c8 100644
--- a/meta/classes/rust-common.bbclass
+++ b/meta/classes/rust-common.bbclass
@@ -83,7 +83,7 @@ def rust_base_triple(d, thing):
     if thing == "TARGET" and target_is_armv7(d):
         arch = "armv7"
     else:
-        arch = d.getVar('{}_ARCH'.format(thing))
+        arch = arch_to_rust_arch(d.getVar('{}_ARCH'.format(thing)))
 
     # All the Yocto targets are Linux and are 'unknown'
     vendor = "-unknown"
diff --git a/meta/classes/rust.bbclass b/meta/classes/rust.bbclass
index 5c8938d09fe5..bb1276215b0f 100644
--- a/meta/classes/rust.bbclass
+++ b/meta/classes/rust.bbclass
@@ -2,14 +2,14 @@ inherit rust-common
 
 RUSTC = "rustc"
 
-RUSTC_ARCHFLAGS += "--target=${HOST_SYS} ${RUSTFLAGS}"
+RUSTC_ARCHFLAGS += "--target=${RUST_HOST_SYS} ${RUSTFLAGS}"
 
 def rust_base_dep(d):
     # Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to
     # use rust instead of gcc
     deps = ""
     if not d.getVar('INHIBIT_DEFAULT_RUST_DEPS'):
-        if (d.getVar('HOST_SYS') != d.getVar('BUILD_SYS')):
+        if (d.getVar('RUST_HOST_SYS') != d.getVar('RUST_BUILD_SYS')):
             deps += " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
         else:
             deps += " rust-native"
@@ -37,9 +37,9 @@ HOST_CFLAGS   ?= "${CFLAGS}"
 HOST_CXXFLAGS ?= "${CXXFLAGS}"
 HOST_CPPFLAGS ?= "${CPPFLAGS}"
 
-rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib"
+rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${RUST_HOST_SYS}/lib"
 # Native sysroot standard library path
 rustlib_src="${prefix}/lib/${rustlib_suffix}"
 # Host sysroot standard library path
 rustlib="${libdir}/${rustlib_suffix}"
-rustlib:class-native="${libdir}/rustlib/${BUILD_SYS}/lib"
+rustlib:class-native="${libdir}/rustlib/${RUST_BUILD_SYS}/lib"
diff --git a/meta/recipes-devtools/rust/rust-common.inc b/meta/recipes-devtools/rust/rust-common.inc
index 4b758260d276..8ba78b978708 100644
--- a/meta/recipes-devtools/rust/rust-common.inc
+++ b/meta/recipes-devtools/rust/rust-common.inc
@@ -249,14 +249,14 @@ TARGET_C_INT_WIDTH[riscv64] = "64"
 MAX_ATOMIC_WIDTH[riscv64] = "64"
 
 def sys_for(d, thing):
-    return d.getVar('{}_SYS'.format(thing))
+    return d.getVar('RUST_{}_SYS'.format(thing))
 
 def prefix_for(d, thing):
     return d.getVar('{}_PREFIX'.format(thing))
 
 # generates our target CPU value
 def llvm_cpu(d):
-    cpu = d.getVar('PACKAGE_ARCH')
+    cpu = arch_to_rust_arch(d.getVar('PACKAGE_ARCH'))
     target = d.getVar('TRANSLATED_TARGET_ARCH')
 
     trans = {}
@@ -298,6 +298,8 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""):
     sys = sys_for(d, thing)
     prefix = prefix_for(d, thing)
 
+    arch = arch_to_rust_arch(arch)
+
     if abi:
         arch_abi = "{}-{}".format(arch, abi)
     else:
@@ -314,7 +316,7 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""):
     tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch_abi)
     tspec['target-c-int-width'] = d.getVarFlag('TARGET_C_INT_WIDTH', arch_abi)
     tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch_abi)
-    tspec['arch'] = arch_to_rust_arch(arch)
+    tspec['arch'] = arch
     tspec['os'] = "linux"
     if "musl" in tspec['llvm-target']:
         tspec['env'] = "musl"
@@ -345,7 +347,7 @@ def rust_gen_target(d, thing, wd, features, cpu, arch, abi=""):
 
 python do_rust_gen_targets () {
     wd = d.getVar('WORKDIR') + '/targets/'
-    build_arch = d.getVar('BUILD_ARCH')
+    build_arch = d.getVar('RUST_BUILD_ARCH')
     rust_gen_target(d, 'BUILD', wd, "", "generic", build_arch)
 }
 
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
index 827000f7bd1e..72226da68926 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian-common.inc
@@ -30,7 +30,7 @@ python do_rust_gen_targets () {
     wd = d.getVar('WORKDIR') + '/targets/'
     rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH'))
     rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH'))
-    rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH'))
+    rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('RUST_BUILD_ARCH'))
 }
 
 INHIBIT_DEFAULT_RUST_DEPS = "1"
@@ -42,8 +42,8 @@ export WRAPPER_TARGET_LDFLAGS = "${TARGET_LDFLAGS}"
 export WRAPPER_TARGET_AR = "${TARGET_PREFIX}ar"
 
 python do_configure:prepend() {
-    targets = [d.getVar("TARGET_SYS", True), "{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))]
-    hosts = ["{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))]
+    targets = [d.getVar("RUST_TARGET_SYS", True), "{}-unknown-linux-gnu".format(d.getVar("RUST_HOST_ARCH", True))]
+    hosts = ["{}-unknown-linux-gnu".format(d.getVar("RUST_HOST_ARCH", True))]
 }
 
 INSANE_SKIP:${RUSTLIB_TARGET_PN} = "file-rdeps arch ldflags"
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index 8bbbd61bdc39..ed8b720d51c2 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -22,7 +22,7 @@ do_install () {
     # The required structure is retained for simplicity.
     SYS_LIBDIR=$(dirname ${D}${libdir})
     SYS_BINDIR=$(dirname ${D}${bindir})
-    RUSTLIB_DIR=${SYS_LIBDIR}/${TARGET_SYS}/rustlib
+    RUSTLIB_DIR=${SYS_LIBDIR}/${RUST_TARGET_SYS}/rustlib
 
     install -d "${SYS_BINDIR}"
     cp build/${SNAPSHOT_BUILD_SYS}/stage2/bin/* ${SYS_BINDIR}
@@ -31,8 +31,8 @@ do_install () {
     done
 
     install -d "${D}${libdir}"
-    cp -pRd build/${SNAPSHOT_BUILD_SYS}/stage2/lib/${TARGET_SYS}/*.so ${SYS_LIBDIR}
-    cp -pRd build/${SNAPSHOT_BUILD_SYS}/stage2/lib/${TARGET_SYS}/rustlib ${RUSTLIB_DIR}
+    cp -pRd build/${SNAPSHOT_BUILD_SYS}/stage2/lib/${RUST_TARGET_SYS}/*.so ${SYS_LIBDIR}
+    cp -pRd build/${SNAPSHOT_BUILD_SYS}/stage2/lib/${RUST_TARGET_SYS}/rustlib ${RUSTLIB_DIR}
 
     for i in ${SYS_LIBDIR}/*.so; do
 	chrpath -r "\$ORIGIN/../lib" ${i}
@@ -41,7 +41,7 @@ do_install () {
 	chrpath -d ${i}
     done
 
-    install -m 0644 "${WORKDIR}/targets/${TARGET_SYS}.json" "${RUSTLIB_DIR}"
+    install -m 0644 "${WORKDIR}/targets/${RUST_TARGET_SYS}.json" "${RUSTLIB_DIR}"
 
     SRC_DIR=${RUSTLIB_DIR}/src/rust
     install -d ${SRC_DIR}/src/llvm-project
@@ -56,8 +56,9 @@ do_install () {
     ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
 
     cat <<- EOF > "${ENV_SETUP_SH}"
-	export RUSTFLAGS="--sysroot=\$OECORE_NATIVE_SYSROOT/usr -C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT -L\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib"
-	export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib"
+	export RUSTFLAGS="--sysroot=\$OECORE_NATIVE_SYSROOT/usr -C
+    link-arg=--sysroot=\$OECORE_TARGET_SYSROOT -L\$OECORE_NATIVE_SYSROOT/usr/lib/${RUST_TARGET_SYS}/rustlib/${RUST_TARGET_SYS}/lib"
+	export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${RUST_TARGET_SYS}/rustlib"
 	EOF
 
     chown -R root.root ${D}
@@ -65,14 +66,14 @@ do_install () {
 
 PKG_SYS_LIBDIR = "${SDKPATHNATIVE}/usr/lib"
 PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
-PKG_RUSTLIB_DIR = "${PKG_SYS_LIBDIR}/${TARGET_SYS}/rustlib"
+PKG_RUSTLIB_DIR = "${PKG_SYS_LIBDIR}/${RUST_TARGET_SYS}/rustlib"
 FILES:${PN} = "${PKG_SYS_LIBDIR}/*.so ${PKG_SYS_BINDIR} ${base_prefix}/environment-setup.d"
-FILES:${RUSTLIB_TARGET_PN} = "${PKG_RUSTLIB_DIR}/${TARGET_SYS} ${PKG_RUSTLIB_DIR}/${TARGET_SYS}.json"
-FILES:${RUSTLIB_HOST_PN} = "${PKG_RUSTLIB_DIR}/${BUILD_ARCH}-unknown-linux-gnu"
+FILES:${RUSTLIB_TARGET_PN} = "${PKG_RUSTLIB_DIR}/${RUST_TARGET_SYS} ${PKG_RUSTLIB_DIR}/${RUST_TARGET_SYS}.json"
+FILES:${RUSTLIB_HOST_PN} = "${PKG_RUSTLIB_DIR}/${RUST_BUILD_ARCH}-unknown-linux-gnu"
 FILES:${RUSTLIB_SRC_PN} = "${PKG_RUSTLIB_DIR}/src"
 
-SUMMARY:${RUSTLIB_TARGET_PN} = "Rust cross canadian libaries for ${TARGET_SYS}"
-SUMMARY:${RUSTLIB_HOST_PN} = "Rust cross canadian libaries for ${HOST_SYS}"
+SUMMARY:${RUSTLIB_TARGET_PN} = "Rust cross canadian libaries for ${RUST_TARGET_SYS}"
+SUMMARY:${RUSTLIB_HOST_PN} = "Rust cross canadian libaries for ${RUST_HOST_SYS}"
 SUMMARY:${RUSTLIB_SRC_PN} = "Rust standard library sources for cross canadian toolchain"
 SUMMARY:${PN} = "Rust crost canadian compiler"
 
diff --git a/meta/recipes-devtools/rust/rust-cross.inc b/meta/recipes-devtools/rust/rust-cross.inc
index a77f7d512233..f7eda58246fa 100644
--- a/meta/recipes-devtools/rust/rust-cross.inc
+++ b/meta/recipes-devtools/rust/rust-cross.inc
@@ -64,7 +64,7 @@ do_compile () {
 
 do_install () {
 	mkdir -p ${D}${prefix}/${base_libdir_native}/rustlib
-	cp ${WORKDIR}/targets/${TARGET_SYS}.json ${D}${prefix}/${base_libdir_native}/rustlib
+	cp ${WORKDIR}/targets/${RUST_TARGET_SYS}.json ${D}${prefix}/${base_libdir_native}/rustlib
 }
 
 rust_cross_sysroot_preprocess() {
diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc
index 1d6f99afad31..cc0730e9cd2d 100644
--- a/meta/recipes-devtools/rust/rust.inc
+++ b/meta/recipes-devtools/rust/rust.inc
@@ -27,7 +27,7 @@ CARGO_DISABLE_BITBAKE_VENDORING = "1"
 
 # We can't use RUST_BUILD_SYS here because that may be "musl" if
 # TCLIBC="musl". Snapshots are always -unknown-linux-gnu
-SNAPSHOT_BUILD_SYS = "${BUILD_ARCH}-unknown-linux-gnu"
+SNAPSHOT_BUILD_SYS = "${RUST_BUILD_ARCH}-unknown-linux-gnu"
 setup_cargo_environment () {
     # The first step is to build bootstrap and some early stage tools,
     # these are build for the same target as the snapshot, e.g.
@@ -48,8 +48,8 @@ do_rust_setup_snapshot () {
 
     # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo
     # and fail without it there.
-    mkdir -p ${RUSTSRC}/build/${BUILD_SYS}
-    ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0
+    mkdir -p ${RUSTSRC}/build/${RUST_BUILD_SYS}
+    ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${RUST_BUILD_SYS}/stage0
 
     # Need to use uninative's loader if enabled/present since the library paths
     # are used internally by rust and result in symbol mismatches if we don't
@@ -79,7 +79,7 @@ python do_configure() {
     config = configparser.RawConfigParser()
 
     # [target.ARCH-poky-linux]
-    target_section = "target.{}".format(d.getVar('TARGET_SYS', True))
+    target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS', True))
     config.add_section(target_section)
 
     llvm_config = d.expand("${YOCTO_ALTERNATE_EXE_PATH}")
@@ -124,11 +124,11 @@ python do_configure() {
     config.set("build", "vendor", e(True))
 
     if not "targets" in locals():
-        targets = [d.getVar("TARGET_SYS", True)]
+        targets = [d.getVar("RUST_TARGET_SYS", True)]
     config.set("build", "target", e(targets))
 
     if not "hosts" in locals():
-        hosts = [d.getVar("HOST_SYS", True)]
+        hosts = [d.getVar("RUST_HOST_SYS", True)]
     config.set("build", "host", e(hosts))
 
     # We can't use BUILD_SYS since that is something the rust snapshot knows
@@ -177,10 +177,10 @@ do_compile () {
 
 rust_do_install () {
     mkdir -p ${D}${bindir}
-    cp build/${HOST_SYS}/stage2/bin/* ${D}${bindir}
+    cp build/${RUST_HOST_SYS}/stage2/bin/* ${D}${bindir}
 
     mkdir -p ${D}${libdir}/rustlib
-    cp -pRd build/${HOST_SYS}/stage2/lib/* ${D}${libdir}
+    cp -pRd build/${RUST_HOST_SYS}/stage2/lib/* ${D}${libdir}
     # Remove absolute symlink so bitbake doesn't complain
     rm -f ${D}${libdir}/rustlib/src/rust
 }
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 5/8] rust: libstd-rs: Install deps under {RUST_,}TARGET_SYS mismatch
  2022-02-22  3:52 [RFC PATCH 0/8] rust: Fix powerpc64le support Andrew Jeffery
                   ` (3 preceding siblings ...)
  2022-02-22  3:52 ` [RFC PATCH 4/8] rust: Consistently use RUST_{BUILD,HOST,TARGET}_{ARCH,SYS} Andrew Jeffery
@ 2022-02-22  3:52 ` Andrew Jeffery
  2022-02-22  3:52 ` [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures Andrew Jeffery
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22  3:52 UTC (permalink / raw)
  To: openembedded-core

The architecture mangling gets a bit too much here. Use globs to paper
over the problem.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 meta/recipes-devtools/rust/libstd-rs.inc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-devtools/rust/libstd-rs.inc b/meta/recipes-devtools/rust/libstd-rs.inc
index 987956344a24..e94fb8d5612e 100644
--- a/meta/recipes-devtools/rust/libstd-rs.inc
+++ b/meta/recipes-devtools/rust/libstd-rs.inc
@@ -35,6 +35,14 @@ do_install () {
     # With the incremental build support added in 1.24, the libstd deps directory also includes dependency
     # files that get installed. Those are really only needed to incrementally rebuild the libstd library
     # itself and don't need to be installed.
-    rm -f ${B}/${TARGET_SYS}/${BUILD_DIR}/deps/*.d
-    cp ${B}/${TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir}
+    #
+    # ${B} contains two directories, one for the target architecture and one for the build mode
+    # (e.g. "release"). In some cases (e.g. ARMv7) the build directory matches neither ${TARGET_SYS}
+    # (due to "unknown" vendor from rust_base_triple()) nor ${RUST_TARGET_SYS} (due to architecture
+    # name mangling in rust_base_triple()). Further, rust_base_triple() always assumes a linux
+    # OS, so exploit both "unknown" and "linux" in a triple glob to select the right source
+    # directory.
+    DEPS=${B}/*-unknown-linux-*/${BUILD_DIR}/deps
+    rm -f ${DEPS}/*.d
+    cp ${DEPS}/* ${D}${rustlibdir}
 }
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures
  2022-02-22  3:52 [RFC PATCH 0/8] rust: Fix powerpc64le support Andrew Jeffery
                   ` (4 preceding siblings ...)
  2022-02-22  3:52 ` [RFC PATCH 5/8] rust: libstd-rs: Install deps under {RUST_,}TARGET_SYS mismatch Andrew Jeffery
@ 2022-02-22  3:52 ` Andrew Jeffery
  2022-02-22  9:57   ` [OE-core] " Alexander Kanavin
  2022-02-22  3:52 ` [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le Andrew Jeffery
  2022-02-22  3:52 ` [RFC PATCH 8/8] rust: Introduce RUST_BUILD_ARCH Andrew Jeffery
  7 siblings, 1 reply; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22  3:52 UTC (permalink / raw)
  To: openembedded-core

This seemed to be an issue for Power once the arch mappings were fixed
(by a patch later in this series).

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 meta/recipes-devtools/rust/rust.inc | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc
index cc0730e9cd2d..fd934082bddf 100644
--- a/meta/recipes-devtools/rust/rust.inc
+++ b/meta/recipes-devtools/rust/rust.inc
@@ -35,8 +35,11 @@ setup_cargo_environment () {
     # Later stages are build for the native target (i.e. target.x86_64-linux)
     cargo_common_do_configure
 
-    printf '[target.%s]\n' "${SNAPSHOT_BUILD_SYS}" >> ${CARGO_HOME}/config
-    printf "linker = '%s'\n" "${RUST_BUILD_CCLD}" >> ${CARGO_HOME}/config
+    if [ ${SNAPSHOT_BUILD_SYS} != ${RUST_BUILD_SYS} ]
+    then
+        printf '[target.%s]\n' "${SNAPSHOT_BUILD_SYS}" >> ${CARGO_HOME}/config
+        printf "linker = '%s'\n" "${RUST_BUILD_CCLD}" >> ${CARGO_HOME}/config
+    fi
 }
 
 include rust-common.inc
@@ -88,15 +91,16 @@ python do_configure() {
     config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}")))
     config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}")))
 
-    # If we don't do this rust-native will compile it's own llvm for BUILD.
-    # [target.${BUILD_ARCH}-unknown-linux-gnu]
-    target_section = "target.{}".format(d.getVar('SNAPSHOT_BUILD_SYS', True))
-    config.add_section(target_section)
+    if (d.getVar('SNAPSHOT_BUILD_SYS') != d.getVar('RUST_TARGET_SYS')):
+        # If we don't do this rust-native will compile it's own llvm for BUILD.
+        # [target.${BUILD_ARCH}-unknown-linux-gnu]
+        target_section = "target.{}".format(d.getVar('SNAPSHOT_BUILD_SYS', True))
+        config.add_section(target_section)
 
-    config.set(target_section, "llvm-config", e(llvm_config))
+        config.set(target_section, "llvm-config", e(llvm_config))
 
-    config.set(target_section, "cxx", e(d.expand("${RUST_BUILD_CXX}")))
-    config.set(target_section, "cc", e(d.expand("${RUST_BUILD_CC}")))
+        config.set(target_section, "cxx", e(d.expand("${RUST_BUILD_CXX}")))
+        config.set(target_section, "cc", e(d.expand("${RUST_BUILD_CC}")))
 
     # [rust]
     config.add_section("rust")
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-22  3:52 [RFC PATCH 0/8] rust: Fix powerpc64le support Andrew Jeffery
                   ` (5 preceding siblings ...)
  2022-02-22  3:52 ` [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures Andrew Jeffery
@ 2022-02-22  3:52 ` Andrew Jeffery
  2022-02-22  9:59   ` [OE-core] " Alexander Kanavin
  2022-02-22  3:52 ` [RFC PATCH 8/8] rust: Introduce RUST_BUILD_ARCH Andrew Jeffery
  7 siblings, 1 reply; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22  3:52 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 meta/recipes-devtools/rust/rust-snapshot.inc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/recipes-devtools/rust/rust-snapshot.inc b/meta/recipes-devtools/rust/rust-snapshot.inc
index 74b558262f62..d6ffe92d07ee 100644
--- a/meta/recipes-devtools/rust/rust-snapshot.inc
+++ b/meta/recipes-devtools/rust/rust-snapshot.inc
@@ -14,6 +14,10 @@ SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "3618da916a0f92f241cf1d67d04bb578
 SRC_URI[rustc-snapshot-aarch64.sha256sum] = "f26811e48d03c56c125de03d389e1ae7c6df36990953c1670c6a5676bc12d4cb"
 SRC_URI[cargo-snapshot-aarch64.sha256sum] = "6d11cd94618d80cda273eeeae7285980445f61a49ebacc616777b482a41cbf3f"
 
+SRC_URI[rust-std-snapshot-powerpc64le.sha256sum] = "fc07eb3e9f3d227428cc5b53ca868e3de375bc198ce4dce7b87a9246e6fec81a"
+SRC_URI[rustc-snapshot-powerpc64le.sha256sum] = "f43cb99109c3438c77c7079cdce4673df3320e310158e0b4d949c1babc4300fc"
+SRC_URI[cargo-snapshot-powerpc64le.sha256sum] = "599cf1b5a8cdbf76d591621bc9222aefa60e2f5fd378ae71c4dcf4514c47122e"
+
 SRC_URI += " \
     https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
     https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [RFC PATCH 8/8] rust: Introduce RUST_BUILD_ARCH
  2022-02-22  3:52 [RFC PATCH 0/8] rust: Fix powerpc64le support Andrew Jeffery
                   ` (6 preceding siblings ...)
  2022-02-22  3:52 ` [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le Andrew Jeffery
@ 2022-02-22  3:52 ` Andrew Jeffery
  7 siblings, 0 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22  3:52 UTC (permalink / raw)
  To: openembedded-core

On modern Power systems `uname -m` yields 'ppc64le' while the toolchain
knows the architecture as 'powerpc64le'. Provide a mapping from one to
the other to download the correct snapshot artifacts.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 meta/classes/rust-common.bbclass             |  3 +++
 meta/recipes-devtools/rust/rust-snapshot.inc | 12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
index 58ece01097c8..2ee7e178e536 100644
--- a/meta/classes/rust-common.bbclass
+++ b/meta/classes/rust-common.bbclass
@@ -107,6 +107,9 @@ def rust_base_triple(d, thing):
         libc = bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d)
     return arch + vendor + '-' + os + libc
 
+# In some cases uname and the toolchain differ on their idea of the arch name
+RUST_BUILD_ARCH = "${@arch_to_rust_arch(d.getVar('BUILD_ARCH'))}"
+
 # Naming explanation
 # Yocto
 # - BUILD_SYS - Yocto triple of the build environment
diff --git a/meta/recipes-devtools/rust/rust-snapshot.inc b/meta/recipes-devtools/rust/rust-snapshot.inc
index d6ffe92d07ee..d0c05aec7866 100644
--- a/meta/recipes-devtools/rust/rust-snapshot.inc
+++ b/meta/recipes-devtools/rust/rust-snapshot.inc
@@ -19,11 +19,11 @@ SRC_URI[rustc-snapshot-powerpc64le.sha256sum] = "f43cb99109c3438c77c7079cdce4673
 SRC_URI[cargo-snapshot-powerpc64le.sha256sum] = "599cf1b5a8cdbf76d591621bc9222aefa60e2f5fd378ae71c4dcf4514c47122e"
 
 SRC_URI += " \
-    https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-    https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-    https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+    https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \
+    https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \
+    https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \
 "
 
-RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu"
+RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu"
+CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu"
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures
  2022-02-22  3:52 ` [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures Andrew Jeffery
@ 2022-02-22  9:57   ` Alexander Kanavin
  2022-02-23  0:38     ` Andrew Jeffery
  0 siblings, 1 reply; 26+ messages in thread
From: Alexander Kanavin @ 2022-02-22  9:57 UTC (permalink / raw)
  To: Andrew Jeffery; +Cc: OE-core

This needs a better explanation. What is the problem and how is it being fixed?

Alex

On Tue, 22 Feb 2022 at 04:52, Andrew Jeffery <andrew@aj.id.au> wrote:
>
> This seemed to be an issue for Power once the arch mappings were fixed
> (by a patch later in this series).
>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>  meta/recipes-devtools/rust/rust.inc | 22 +++++++++++++---------
>  1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc
> index cc0730e9cd2d..fd934082bddf 100644
> --- a/meta/recipes-devtools/rust/rust.inc
> +++ b/meta/recipes-devtools/rust/rust.inc
> @@ -35,8 +35,11 @@ setup_cargo_environment () {
>      # Later stages are build for the native target (i.e. target.x86_64-linux)
>      cargo_common_do_configure
>
> -    printf '[target.%s]\n' "${SNAPSHOT_BUILD_SYS}" >> ${CARGO_HOME}/config
> -    printf "linker = '%s'\n" "${RUST_BUILD_CCLD}" >> ${CARGO_HOME}/config
> +    if [ ${SNAPSHOT_BUILD_SYS} != ${RUST_BUILD_SYS} ]
> +    then
> +        printf '[target.%s]\n' "${SNAPSHOT_BUILD_SYS}" >> ${CARGO_HOME}/config
> +        printf "linker = '%s'\n" "${RUST_BUILD_CCLD}" >> ${CARGO_HOME}/config
> +    fi
>  }
>
>  include rust-common.inc
> @@ -88,15 +91,16 @@ python do_configure() {
>      config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}")))
>      config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}")))
>
> -    # If we don't do this rust-native will compile it's own llvm for BUILD.
> -    # [target.${BUILD_ARCH}-unknown-linux-gnu]
> -    target_section = "target.{}".format(d.getVar('SNAPSHOT_BUILD_SYS', True))
> -    config.add_section(target_section)
> +    if (d.getVar('SNAPSHOT_BUILD_SYS') != d.getVar('RUST_TARGET_SYS')):
> +        # If we don't do this rust-native will compile it's own llvm for BUILD.
> +        # [target.${BUILD_ARCH}-unknown-linux-gnu]
> +        target_section = "target.{}".format(d.getVar('SNAPSHOT_BUILD_SYS', True))
> +        config.add_section(target_section)
>
> -    config.set(target_section, "llvm-config", e(llvm_config))
> +        config.set(target_section, "llvm-config", e(llvm_config))
>
> -    config.set(target_section, "cxx", e(d.expand("${RUST_BUILD_CXX}")))
> -    config.set(target_section, "cc", e(d.expand("${RUST_BUILD_CC}")))
> +        config.set(target_section, "cxx", e(d.expand("${RUST_BUILD_CXX}")))
> +        config.set(target_section, "cc", e(d.expand("${RUST_BUILD_CC}")))
>
>      # [rust]
>      config.add_section("rust")
> --
> 2.32.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162120): https://lists.openembedded.org/g/openembedded-core/message/162120
> Mute This Topic: https://lists.openembedded.org/mt/89310362/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-22  3:52 ` [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le Andrew Jeffery
@ 2022-02-22  9:59   ` Alexander Kanavin
  2022-02-22 12:28     ` Richard Purdie
  0 siblings, 1 reply; 26+ messages in thread
From: Alexander Kanavin @ 2022-02-22  9:59 UTC (permalink / raw)
  To: Andrew Jeffery; +Cc: OE-core

I have to note that YP does not support ppc systems as build hosts;
can this be kept in a bbappend?

Alex

On Tue, 22 Feb 2022 at 04:52, Andrew Jeffery <andrew@aj.id.au> wrote:
>
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>  meta/recipes-devtools/rust/rust-snapshot.inc | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/meta/recipes-devtools/rust/rust-snapshot.inc b/meta/recipes-devtools/rust/rust-snapshot.inc
> index 74b558262f62..d6ffe92d07ee 100644
> --- a/meta/recipes-devtools/rust/rust-snapshot.inc
> +++ b/meta/recipes-devtools/rust/rust-snapshot.inc
> @@ -14,6 +14,10 @@ SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "3618da916a0f92f241cf1d67d04bb578
>  SRC_URI[rustc-snapshot-aarch64.sha256sum] = "f26811e48d03c56c125de03d389e1ae7c6df36990953c1670c6a5676bc12d4cb"
>  SRC_URI[cargo-snapshot-aarch64.sha256sum] = "6d11cd94618d80cda273eeeae7285980445f61a49ebacc616777b482a41cbf3f"
>
> +SRC_URI[rust-std-snapshot-powerpc64le.sha256sum] = "fc07eb3e9f3d227428cc5b53ca868e3de375bc198ce4dce7b87a9246e6fec81a"
> +SRC_URI[rustc-snapshot-powerpc64le.sha256sum] = "f43cb99109c3438c77c7079cdce4673df3320e310158e0b4d949c1babc4300fc"
> +SRC_URI[cargo-snapshot-powerpc64le.sha256sum] = "599cf1b5a8cdbf76d591621bc9222aefa60e2f5fd378ae71c4dcf4514c47122e"
> +
>  SRC_URI += " \
>      https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
>      https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
> --
> 2.32.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162121): https://lists.openembedded.org/g/openembedded-core/message/162121
> Mute This Topic: https://lists.openembedded.org/mt/89310363/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 1/8] rust: Migrate arch_to_rust_target_arch() to rust-common class
  2022-02-22  3:52 ` [RFC PATCH 1/8] rust: Migrate arch_to_rust_target_arch() to rust-common class Andrew Jeffery
@ 2022-02-22 10:05   ` Richard Purdie
  2022-02-23  0:41     ` Andrew Jeffery
  0 siblings, 1 reply; 26+ messages in thread
From: Richard Purdie @ 2022-02-22 10:05 UTC (permalink / raw)
  To: Andrew Jeffery, openembedded-core

On Tue, 2022-02-22 at 14:22 +1030, Andrew Jeffery wrote:
> This will allow us to use it elsewhere for architecture name
> translation. This move is motivated by powerpc64le support.
> 
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>  meta/classes/rust-common.bbclass           | 16 ++++++++++++++++
>  meta/recipes-devtools/rust/rust-common.inc | 16 ----------------
>  2 files changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
> index 98d65970e8c0..2f2a31867ad0 100644
> --- a/meta/classes/rust-common.bbclass
> +++ b/meta/classes/rust-common.bbclass
> @@ -1,5 +1,21 @@
>  inherit python3native
>  
> +# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something
> +# rust's internals won't choke on.
> +def arch_to_rust_target_arch(arch):
> +    if arch == "i586" or arch == "i686":
> +        return "x86"
> +    elif arch == "mipsel":
> +        return "mips"
> +    elif arch == "mip64sel":
> +        return "mips64"
> +    elif arch == "armv7":
> +        return "arm"
> +    elif arch == "powerpc64le":
> +        return "powerpc64"
> +    else:
> +        return arch
> +
>  # Common variables used by all Rust builds
>  export rustlibdir = "${libdir}/rust"
>  FILES:${PN} += "${rustlibdir}/*.so"


If we're moving this, it may be a good candidate to move to a new
meta/lib/oe/rust.py python function library for rust. I appreciate that is
slightly move involved and will likely need the imports in base.bbclass to be
tweaked but is probably the better long term fix.

Cheers,

Richard





^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-22  9:59   ` [OE-core] " Alexander Kanavin
@ 2022-02-22 12:28     ` Richard Purdie
  2022-02-22 14:23       ` Alexander Kanavin
  2022-02-22 23:49       ` Andrew Jeffery
  0 siblings, 2 replies; 26+ messages in thread
From: Richard Purdie @ 2022-02-22 12:28 UTC (permalink / raw)
  To: Alexander Kanavin, Andrew Jeffery; +Cc: OE-core

On Tue, 2022-02-22 at 10:59 +0100, Alexander Kanavin wrote:
> I have to note that YP does not support ppc systems as build hosts;
> can this be kept in a bbappend?

It isn't official but there are obviously people using it. I think we should try
and do something in core but there is a question of how we maintain this given
our infrastructure/tests don't cover it :(

Cheers,

Richard



^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-22 12:28     ` Richard Purdie
@ 2022-02-22 14:23       ` Alexander Kanavin
  2022-02-22 18:34         ` Khem Raj
  2022-02-23  0:17         ` Andrew Jeffery
  2022-02-22 23:49       ` Andrew Jeffery
  1 sibling, 2 replies; 26+ messages in thread
From: Alexander Kanavin @ 2022-02-22 14:23 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Andrew Jeffery, OE-core

On Tue, 22 Feb 2022 at 13:28, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Tue, 2022-02-22 at 10:59 +0100, Alexander Kanavin wrote:
> > I have to note that YP does not support ppc systems as build hosts;
> > can this be kept in a bbappend?
>
> It isn't official but there are obviously people using it. I think we should try
> and do something in core but there is a question of how we maintain this given
> our infrastructure/tests don't cover it :(

Worse yet, there is no way to test this locally either.  If the ppc64
binary tarball checksums are added to the core rust recipe, presumably
I'd be expected to update them together with x86 and arm64 binary
checksums on version updates, but I'd have to do this completely
blindly with no testing of any kind :( That's why I am asking to keep
them in an external bbappend.

Andrew, how hard is it to obtain a shell on ppc64 machines nowadays?
Is it something specific to your employer?

Alex


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-22 14:23       ` Alexander Kanavin
@ 2022-02-22 18:34         ` Khem Raj
  2022-02-22 23:41           ` Andrew Jeffery
  2022-02-23  0:17         ` Andrew Jeffery
  1 sibling, 1 reply; 26+ messages in thread
From: Khem Raj @ 2022-02-22 18:34 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: Richard Purdie, Andrew Jeffery, OE-core

On Tue, Feb 22, 2022 at 6:24 AM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> On Tue, 22 Feb 2022 at 13:28, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> >
> > On Tue, 2022-02-22 at 10:59 +0100, Alexander Kanavin wrote:
> > > I have to note that YP does not support ppc systems as build hosts;
> > > can this be kept in a bbappend?
> >
> > It isn't official but there are obviously people using it. I think we should try
> > and do something in core but there is a question of how we maintain this given
> > our infrastructure/tests don't cover it :(
>
> Worse yet, there is no way to test this locally either.  If the ppc64
> binary tarball checksums are added to the core rust recipe, presumably
> I'd be expected to update them together with x86 and arm64 binary
> checksums on version updates, but I'd have to do this completely
> blindly with no testing of any kind :(

as long as it does not impede main testing I would think thats ok and
we can expect the OE community
members like Andrew to test this and report issues or better fix them

That's why I am asking to keep
> them in an external bbappend.
>
> Andrew, how hard is it to obtain a shell on ppc64 machines nowadays?
> Is it something specific to your employer?
>
> Alex
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#162134): https://lists.openembedded.org/g/openembedded-core/message/162134
> Mute This Topic: https://lists.openembedded.org/mt/89310363/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-22 18:34         ` Khem Raj
@ 2022-02-22 23:41           ` Andrew Jeffery
  0 siblings, 0 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22 23:41 UTC (permalink / raw)
  To: Khem Raj, Alexander Kanavin; +Cc: Richard Purdie, OE-core



On Wed, 23 Feb 2022, at 05:04, Khem Raj wrote:
> On Tue, Feb 22, 2022 at 6:24 AM Alexander Kanavin
> <alex.kanavin@gmail.com> wrote:
>>
>> On Tue, 22 Feb 2022 at 13:28, Richard Purdie
>> <richard.purdie@linuxfoundation.org> wrote:
>> >
>> > On Tue, 2022-02-22 at 10:59 +0100, Alexander Kanavin wrote:
>> > > I have to note that YP does not support ppc systems as build hosts;
>> > > can this be kept in a bbappend?
>> >
>> > It isn't official but there are obviously people using it. I think we should try
>> > and do something in core but there is a question of how we maintain this given
>> > our infrastructure/tests don't cover it :(
>>
>> Worse yet, there is no way to test this locally either.  If the ppc64
>> binary tarball checksums are added to the core rust recipe, presumably
>> I'd be expected to update them together with x86 and arm64 binary
>> checksums on version updates, but I'd have to do this completely
>> blindly with no testing of any kind :(
>
> as long as it does not impede main testing I would think thats ok and
> we can expect the OE community
> members like Andrew to test this and report issues or better fix them

Well, hopefully I've shown I'm at least willing to try fix things :D

And yeah, my preference would be that the ppc64le checksums are just 
bumped along with the rest, but without any explicit testing beyond 
that. I understand that I'm not the maintainer here so will go along 
with whatever approach is chosen, but keeping them here feels like 
we're at least solving the problem in a consistent spot.

As mentioned in the cover letter we found this issue via the ppc64le CI 
machines used in OpenBMC. OpenBMC tries to integrate upstream YP 
changes every fortnight or so. That's obviously not as ideal as ppc64le 
resources dedicated to YP, but I think this provides enough feedback 
that things won't completely rot.

If a bump does cause issues I'll try to resolve them as soon as possible.

Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-22 12:28     ` Richard Purdie
  2022-02-22 14:23       ` Alexander Kanavin
@ 2022-02-22 23:49       ` Andrew Jeffery
  2022-02-23  0:03         ` Richard Purdie
  1 sibling, 1 reply; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-22 23:49 UTC (permalink / raw)
  To: Richard Purdie, Alexander Kanavin; +Cc: OE-core



On Tue, 22 Feb 2022, at 22:58, Richard Purdie wrote:
> On Tue, 2022-02-22 at 10:59 +0100, Alexander Kanavin wrote:
>> I have to note that YP does not support ppc systems as build hosts;
>> can this be kept in a bbappend?
>
> It isn't official but there are obviously people using it. I think we should try
> and do something in core but there is a question of how we maintain this given
> our infrastructure/tests don't cover it :(

That's fair. Is it acceptable that it's tested by proxy in OpenBMC if 
we can't work out anything else for YP CI? I don't expect anyone 
maintaining the rust support to test ppc64le explicitly if they don't 
have access. I'd be happy if the ppc64le checksums were just updated 
along with the rest whenever the snapshots are bumped.

Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-22 23:49       ` Andrew Jeffery
@ 2022-02-23  0:03         ` Richard Purdie
  2022-02-23  0:27           ` Andrew Jeffery
  0 siblings, 1 reply; 26+ messages in thread
From: Richard Purdie @ 2022-02-23  0:03 UTC (permalink / raw)
  To: Andrew Jeffery, Alexander Kanavin; +Cc: OE-core

On Wed, 2022-02-23 at 10:19 +1030, Andrew Jeffery wrote:
> 
> On Tue, 22 Feb 2022, at 22:58, Richard Purdie wrote:
> > On Tue, 2022-02-22 at 10:59 +0100, Alexander Kanavin wrote:
> > > I have to note that YP does not support ppc systems as build hosts;
> > > can this be kept in a bbappend?
> > 
> > It isn't official but there are obviously people using it. I think we should try
> > and do something in core but there is a question of how we maintain this given
> > our infrastructure/tests don't cover it :(
> 
> That's fair. Is it acceptable that it's tested by proxy in OpenBMC if 
> we can't work out anything else for YP CI? I don't expect anyone 
> maintaining the rust support to test ppc64le explicitly if they don't 
> have access. I'd be happy if the ppc64le checksums were just updated 
> along with the rest whenever the snapshots are bumped.

The challenge is we have no tooling or support for "bumping" those values. We
spot issues with the other two build architectures since the autobuilder tests
them.

There are probably some tricks we could play to handle this. The challenge is
then that someone needs to take the time to write something to handle this and
communicate it to the maintainers so they know to use it. We're struggling to do
all the things like this we'd like to and that leads back to Alex's concern.

Cheers,

Richard





^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-22 14:23       ` Alexander Kanavin
  2022-02-22 18:34         ` Khem Raj
@ 2022-02-23  0:17         ` Andrew Jeffery
  1 sibling, 0 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-23  0:17 UTC (permalink / raw)
  To: Alexander Kanavin, Richard Purdie; +Cc: OE-core



On Wed, 23 Feb 2022, at 00:53, Alexander Kanavin wrote:
> On Tue, 22 Feb 2022 at 13:28, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
>>
>> On Tue, 2022-02-22 at 10:59 +0100, Alexander Kanavin wrote:
>> > I have to note that YP does not support ppc systems as build hosts;
>> > can this be kept in a bbappend?
>>
>> It isn't official but there are obviously people using it. I think we should try
>> and do something in core but there is a question of how we maintain this given
>> our infrastructure/tests don't cover it :(
>
> Worse yet, there is no way to test this locally either.  If the ppc64
> binary tarball checksums are added to the core rust recipe, presumably
> I'd be expected to update them together with x86 and arm64 binary
> checksums on version updates, but I'd have to do this completely
> blindly with no testing of any kind :( That's why I am asking to keep
> them in an external bbappend.
>
> Andrew, how hard is it to obtain a shell on ppc64 machines nowadays?

(I work for IBM Power Systems)

IBM have partnered with Oregon State University to provide access to 
ppc64le machines:

* https://osuosl.org/services/powerdev/
* https://power-developer.mybluemix.net/#hardware

You can request access to the OSU setup:

* For a shell: https://osuosl.org/services/powerdev/request_hosting/
* For CI: https://osuosl.org/services/powerdev/request_powerci/

So there are some forms. I'm not sure where the bar sits for you with 
respect to how hard it is to go this route, but feel free to reply to 
me privately or via andrewrj@au1.ibm.com if you have further questions 
about setting something up on the OSU OSL infrastructure.

Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-23  0:03         ` Richard Purdie
@ 2022-02-23  0:27           ` Andrew Jeffery
  2022-02-23  0:43             ` Richard Purdie
  0 siblings, 1 reply; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-23  0:27 UTC (permalink / raw)
  To: Richard Purdie, Alexander Kanavin; +Cc: OE-core



On Wed, 23 Feb 2022, at 10:33, Richard Purdie wrote:
> On Wed, 2022-02-23 at 10:19 +1030, Andrew Jeffery wrote:
>> 
>> On Tue, 22 Feb 2022, at 22:58, Richard Purdie wrote:
>> > On Tue, 2022-02-22 at 10:59 +0100, Alexander Kanavin wrote:
>> > > I have to note that YP does not support ppc systems as build hosts;
>> > > can this be kept in a bbappend?
>> > 
>> > It isn't official but there are obviously people using it. I think we should try
>> > and do something in core but there is a question of how we maintain this given
>> > our infrastructure/tests don't cover it :(
>> 
>> That's fair. Is it acceptable that it's tested by proxy in OpenBMC if 
>> we can't work out anything else for YP CI? I don't expect anyone 
>> maintaining the rust support to test ppc64le explicitly if they don't 
>> have access. I'd be happy if the ppc64le checksums were just updated 
>> along with the rest whenever the snapshots are bumped.
>
> The challenge is we have no tooling or support for "bumping" those values. 

Yeah, that's familiar, when I sent the initial patch fixing the URLs I 
hacked some stuff to force the BUILD_ARCH value to ppc64le on my x86-64 
laptop. That's not a scalable approach.

Not having the tooling seems reasonable, as having it does kinda 
suggest you'll try to maintain things you can't test. Even though I'm 
trying to argue for that, again, it's not scalable and I understand the 
push-back :)

> We
> spot issues with the other two build architectures since the autobuilder tests
> them.
>
> There are probably some tricks we could play to handle this. The challenge is
> then that someone needs to take the time to write something to handle this and
> communicate it to the maintainers so they know to use it. We're struggling to do
> all the things like this we'd like to and that leads back to Alex's concern.

I understand.

I have pointed Alex at some resources to access ppc64le systems:

https://lore.kernel.org/openembedded-core/ee6810ac-3c22-45b0-ac49-e35b38e0f69c@www.fastmail.com/

But if that's too much fuss then we can maintain the checksums in a 
bbappend in OpenBMC like has been suggested.

Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures
  2022-02-22  9:57   ` [OE-core] " Alexander Kanavin
@ 2022-02-23  0:38     ` Andrew Jeffery
  2022-02-28  0:13       ` Andrew Jeffery
  0 siblings, 1 reply; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-23  0:38 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core



On Tue, 22 Feb 2022, at 20:27, Alexander Kanavin wrote:
> This needs a better explanation. 

Ack.

>What is the problem and how is it being fixed?

The immediate error was the build bailed out complaining of duplicate 
sections in the config. Possibly this is an indication of a broken build 
configuration rather than the code needing fixes, but this is how I 
made the problem go away. As mentioned I kind of just slashed my way 
though everything. It deserves some closer analysis like you stated 
above.

Let me take some time to get a better grip on what's happening here.

Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 1/8] rust: Migrate arch_to_rust_target_arch() to rust-common class
  2022-02-22 10:05   ` [OE-core] " Richard Purdie
@ 2022-02-23  0:41     ` Andrew Jeffery
  0 siblings, 0 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-23  0:41 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core



On Tue, 22 Feb 2022, at 20:35, Richard Purdie wrote:
> On Tue, 2022-02-22 at 14:22 +1030, Andrew Jeffery wrote:
>> This will allow us to use it elsewhere for architecture name
>> translation. This move is motivated by powerpc64le support.
>> 
>> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
>> ---
>>  meta/classes/rust-common.bbclass           | 16 ++++++++++++++++
>>  meta/recipes-devtools/rust/rust-common.inc | 16 ----------------
>>  2 files changed, 16 insertions(+), 16 deletions(-)
>> 
>> diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
>> index 98d65970e8c0..2f2a31867ad0 100644
>> --- a/meta/classes/rust-common.bbclass
>> +++ b/meta/classes/rust-common.bbclass
>> @@ -1,5 +1,21 @@
>>  inherit python3native
>>  
>> +# Convert a normal arch (HOST_ARCH, TARGET_ARCH, BUILD_ARCH, etc) to something
>> +# rust's internals won't choke on.
>> +def arch_to_rust_target_arch(arch):
>> +    if arch == "i586" or arch == "i686":
>> +        return "x86"
>> +    elif arch == "mipsel":
>> +        return "mips"
>> +    elif arch == "mip64sel":
>> +        return "mips64"
>> +    elif arch == "armv7":
>> +        return "arm"
>> +    elif arch == "powerpc64le":
>> +        return "powerpc64"
>> +    else:
>> +        return arch
>> +
>>  # Common variables used by all Rust builds
>>  export rustlibdir = "${libdir}/rust"
>>  FILES:${PN} += "${rustlibdir}/*.so"
>
>
> If we're moving this, it may be a good candidate to move to a new
> meta/lib/oe/rust.py python function library for rust. I appreciate that is
> slightly move involved and will likely need the imports in base.bbclass to be
> tweaked but is probably the better long term fix.

I'll take a look.

Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le
  2022-02-23  0:27           ` Andrew Jeffery
@ 2022-02-23  0:43             ` Richard Purdie
  0 siblings, 0 replies; 26+ messages in thread
From: Richard Purdie @ 2022-02-23  0:43 UTC (permalink / raw)
  To: Andrew Jeffery, Alexander Kanavin; +Cc: OE-core

On Wed, 2022-02-23 at 10:57 +1030, Andrew Jeffery wrote:
> 
> On Wed, 23 Feb 2022, at 10:33, Richard Purdie wrote:
> > On Wed, 2022-02-23 at 10:19 +1030, Andrew Jeffery wrote:
> > > 
> > > On Tue, 22 Feb 2022, at 22:58, Richard Purdie wrote:
> > > > On Tue, 2022-02-22 at 10:59 +0100, Alexander Kanavin wrote:
> > > > > I have to note that YP does not support ppc systems as build hosts;
> > > > > can this be kept in a bbappend?
> > > > 
> > > > It isn't official but there are obviously people using it. I think we should try
> > > > and do something in core but there is a question of how we maintain this given
> > > > our infrastructure/tests don't cover it :(
> > > 
> > > That's fair. Is it acceptable that it's tested by proxy in OpenBMC if 
> > > we can't work out anything else for YP CI? I don't expect anyone 
> > > maintaining the rust support to test ppc64le explicitly if they don't 
> > > have access. I'd be happy if the ppc64le checksums were just updated 
> > > along with the rest whenever the snapshots are bumped.
> > 
> > The challenge is we have no tooling or support for "bumping" those values. 
> 
> Yeah, that's familiar, when I sent the initial patch fixing the URLs I 
> hacked some stuff to force the BUILD_ARCH value to ppc64le on my x86-64 
> laptop. That's not a scalable approach.

Funnily enough, tweaking BUILD_ARCH was something I was wondering about in some
of our automated tests since that might reduce the changes of some things
breaking.

> Not having the tooling seems reasonable, as having it does kinda 
> suggest you'll try to maintain things you can't test. Even though I'm 
> trying to argue for that, again, it's not scalable and I understand the 
> push-back :)

That is the big worry as we can't really test it.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures
  2022-02-23  0:38     ` Andrew Jeffery
@ 2022-02-28  0:13       ` Andrew Jeffery
  2022-02-28  8:21         ` Alexander Kanavin
  0 siblings, 1 reply; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-28  0:13 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core



On Wed, 23 Feb 2022, at 11:08, Andrew Jeffery wrote:
> On Tue, 22 Feb 2022, at 20:27, Alexander Kanavin wrote:
>> This needs a better explanation. 
>
> Ack.
>
>>What is the problem and how is it being fixed?
>
> The immediate error was the build bailed out complaining of duplicate 
> sections in the config. Possibly this is an indication of a broken build 
> configuration rather than the code needing fixes

Okay, so the root cause of this was I was setting RUST_{HOST,TARGET}_SYS
to "powerpc64le-unknown-linux-gnu", which matched RUST_BUILD_SYS. I did
that because rustc seems to be quite unhappy when supplied with
`--target ppc64le-linux` or `--target powerpc64le-linux'. I'm trying to
understand why, but I'm struggling because rustc seems just fine with
`--target x86_64-linux` despite none of `ppc64le-linux`,
`powerpc64le-linux` nor `x86_64-linux` appearing in the `rustc --print
target-list` output that I could gather.

How/why does `--target x86_64-linux` work?

Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures
  2022-02-28  0:13       ` Andrew Jeffery
@ 2022-02-28  8:21         ` Alexander Kanavin
  2022-02-28 13:57           ` Andrew Jeffery
  0 siblings, 1 reply; 26+ messages in thread
From: Alexander Kanavin @ 2022-02-28  8:21 UTC (permalink / raw)
  To: Andrew Jeffery; +Cc: OE-core

On Mon, 28 Feb 2022 at 01:13, Andrew Jeffery <andrew@aj.id.au> wrote:
> Okay, so the root cause of this was I was setting RUST_{HOST,TARGET}_SYS
> to "powerpc64le-unknown-linux-gnu", which matched RUST_BUILD_SYS. I did
> that because rustc seems to be quite unhappy when supplied with
> `--target ppc64le-linux` or `--target powerpc64le-linux'. I'm trying to
> understand why, but I'm struggling because rustc seems just fine with
> `--target x86_64-linux` despite none of `ppc64le-linux`,
> `powerpc64le-linux` nor `x86_64-linux` appearing in the `rustc --print
> target-list` output that I could gather.
>
> How/why does `--target x86_64-linux` work?

I think in the context of oe-core, all targets are custom ones,
specified by writing out json files and directing rust to use them. So
you need to do two things:
1. --print target-list is useless and irrelevant, as it only prints
built-in targets, don't try it.
2. When there's a problem inspect what json files are in the sysroot,
what they contain, and whether rust is able to find them.
x86_64-linux.json is made specifically for building native items.

Alex


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [OE-core] [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures
  2022-02-28  8:21         ` Alexander Kanavin
@ 2022-02-28 13:57           ` Andrew Jeffery
  0 siblings, 0 replies; 26+ messages in thread
From: Andrew Jeffery @ 2022-02-28 13:57 UTC (permalink / raw)
  To: Alexander Kanavin; +Cc: OE-core



On Mon, 28 Feb 2022, at 18:51, Alexander Kanavin wrote:
> On Mon, 28 Feb 2022 at 01:13, Andrew Jeffery <andrew@aj.id.au> wrote:
>> Okay, so the root cause of this was I was setting RUST_{HOST,TARGET}_SYS
>> to "powerpc64le-unknown-linux-gnu", which matched RUST_BUILD_SYS. I did
>> that because rustc seems to be quite unhappy when supplied with
>> `--target ppc64le-linux` or `--target powerpc64le-linux'. I'm trying to
>> understand why, but I'm struggling because rustc seems just fine with
>> `--target x86_64-linux` despite none of `ppc64le-linux`,
>> `powerpc64le-linux` nor `x86_64-linux` appearing in the `rustc --print
>> target-list` output that I could gather.
>>
>> How/why does `--target x86_64-linux` work?
>
> I think in the context of oe-core, all targets are custom ones,
> specified by writing out json files and directing rust to use them. So
> you need to do two things:
> 1. --print target-list is useless and irrelevant, as it only prints
> built-in targets, don't try it.

Ack, certainly experienced that :)

> 2. When there's a problem inspect what json files are in the sysroot,
> what they contain, and whether rust is able to find them.
> x86_64-linux.json is made specifically for building native items.

Thanks, this helped a lot. Before sending the previous mail I had poked 
around a bit and found the json support in rust, but hadn't put enough 
of the puzzle pieces together to make the picture clear. With your 
pointer here I've cut away most of the cruft in the series and am 
testing the rework now.

Andrew


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2022-02-28 13:57 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22  3:52 [RFC PATCH 0/8] rust: Fix powerpc64le support Andrew Jeffery
2022-02-22  3:52 ` [RFC PATCH 1/8] rust: Migrate arch_to_rust_target_arch() to rust-common class Andrew Jeffery
2022-02-22 10:05   ` [OE-core] " Richard Purdie
2022-02-23  0:41     ` Andrew Jeffery
2022-02-22  3:52 ` [RFC PATCH 2/8] rust: Rename arch_to_rust_target_arch() for generality Andrew Jeffery
2022-02-22  3:52 ` [RFC PATCH 3/8] rust: Handle Power arch variants in arch_to_rust_arch() Andrew Jeffery
2022-02-22  3:52 ` [RFC PATCH 4/8] rust: Consistently use RUST_{BUILD,HOST,TARGET}_{ARCH,SYS} Andrew Jeffery
2022-02-22  3:52 ` [RFC PATCH 5/8] rust: libstd-rs: Install deps under {RUST_,}TARGET_SYS mismatch Andrew Jeffery
2022-02-22  3:52 ` [RFC PATCH 6/8] rust: Mitigate duplicate sections on matching architectures Andrew Jeffery
2022-02-22  9:57   ` [OE-core] " Alexander Kanavin
2022-02-23  0:38     ` Andrew Jeffery
2022-02-28  0:13       ` Andrew Jeffery
2022-02-28  8:21         ` Alexander Kanavin
2022-02-28 13:57           ` Andrew Jeffery
2022-02-22  3:52 ` [RFC PATCH 7/8] rust: Add snapshot checksums for powerpc64le Andrew Jeffery
2022-02-22  9:59   ` [OE-core] " Alexander Kanavin
2022-02-22 12:28     ` Richard Purdie
2022-02-22 14:23       ` Alexander Kanavin
2022-02-22 18:34         ` Khem Raj
2022-02-22 23:41           ` Andrew Jeffery
2022-02-23  0:17         ` Andrew Jeffery
2022-02-22 23:49       ` Andrew Jeffery
2022-02-23  0:03         ` Richard Purdie
2022-02-23  0:27           ` Andrew Jeffery
2022-02-23  0:43             ` Richard Purdie
2022-02-22  3:52 ` [RFC PATCH 8/8] rust: Introduce RUST_BUILD_ARCH Andrew Jeffery

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.