On 27-08-2026 11:01 pm, Richard Purdie wrote:
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know
the content is safe.
On Fri, 2026-08-21 at 14:25 +0530, Sadineni, Harish via lists.openembedded.org
wrote:
Even though the script filename includes ${RUST_TARGET_SYS}, for
multilib SDKs both the 32-bit and 64-bit scripts end up in the same
environment-setup directory.
The SDK's environment-sourcing logic sources every '*.sh' file in
that directory, so both scripts get sourced regardless of which
target you're building for. Since 'CARGO_TARGET_<TRIPLE>_RUSTFLAGS'
and 'CARGO_BUILD_TARGET' are set unconditionally in each script,
whichever one is sourced last wins and that can silently override the
32-bit settings with the 64-bit ones (or vice versa). That's what
causes the 32-bit Cargo build to fail.
Ok, can you point me to which "environment-sourcing logic" we're taking
about? Is this in the test code or within the SDK itself. I suspect we
should be fixing that issue...
Hi Richard,
toolchain-scripts.bbclass is responsible for generating the
environment-setup-* files for the SDK, and
the generated script includes logic (in toolchain_shared_env_script())
that sources every .sh file in the
environment-setup.d/ directory (both under $OECORE_TARGET_SYSROOT and
$OECORE_NATIVE_SYSROOT).
https://git.openembedded.org/openembedded-core/tree/meta/classes-recipe/toolchain-scripts.bbclass#n164
Putting each script in a target-specific subdirectory (environment-
setup.d/${TARGET_SYS}/) ensures only the script matching the selected
target gets sourced, so the two configurations no longer clobber each
other.
Perhaps. I'd like to avoid the complexity if we can so I'd like to
understand more about where this is happening.
This is happening with multilib enabled, do_testsdk & In sdk 32-bit
cargo build fails because of this issue.
I've got another implementation this can be fixed with a if condition
based on target arch instead of a subdirectory.
New approach is below with this we can also drop "[PATCH v2 2/3]
toolchain-scripts: source target-specific environment setup scripts"
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -58,9 +58,13 @@ do_install () {
RUST_TARGET_TRIPLE=`echo ${RUST_TARGET_SYS} | tr '[:lower:]'
'[:upper:]' | sed 's/-/_/g'`
cat <<- EOF > "${RUST_ENV_SETUP_SH}"
- export
CARGO_TARGET_${RUST_TARGET_TRIPLE}_RUSTFLAGS="--sysroot=\$OECORE_TARGET_SYSROOT/usr
-C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT"
- export CARGO_BUILD_TARGET="${RUST_TARGET_SYS}"
- export
RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib"
+
LIB_PATH="\$OECORE_TARGET_SYSROOT/usr/${baselib}/rustlib/${RUST_TARGET_SYS}/lib"
+ export
CARGO_TARGET_${RUST_TARGET_TRIPLE}_RUSTFLAGS="--sysroot=\$OECORE_TARGET_SYSROOT/usr
-C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT -L \$LIB_PATH"
+ if [ "\$OECORE_TARGET_ARCH" = "${TARGET_ARCH}" ]; then
+ export RUST_TARGET_SYS_VALUE="${RUST_TARGET_SYS}"
+ export CARGO_BUILD_TARGET="${RUST_TARGET_SYS}"
+ export
RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib"
+ fi
EOF
chown -R root.root ${D}
If this fine?, i will send a v3.
Thanks,
Harish
Cheers,
Richard
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#245303):
https://lists.openembedded.org/g/openembedded-core/message/245303
Mute This Topic: https://lists.openembedded.org/mt/120640029/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-