From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Harish.Sadineni@windriver.com, openembedded-core@lists.openembedded.org
Cc: Sundeep.Kokkonda@windriver.com
Subject: Re: [OE-core] [PATCH v2 2/3] toolchain-scripts: source target-specific environment setup scripts
Date: Mon, 07 Sep 2026 22:56:32 +0100 [thread overview]
Message-ID: <19734acbbb01f4ad17ab04a23fd92295b0e5db6f.camel@linuxfoundation.org> (raw)
In-Reply-To: <20260807093116.3680514-2-Harish.Sadineni@windriver.com>
On Fri, 2026-08-07 at 02:31 -0700, Sadineni, Harish via lists.openembedded.org wrote:
> From: Harish Sadineni <Harish.Sadineni@windriver.com>
>
> YOCTO [#15061]
>
> Export `OECORE_TARGET_SYS` in the generated SDK and tree environment
> setup scripts, and source any `*.sh` files from
> `environment-setup.d/${TARGET_SYS}` in addition to the existing
> `environment-setup.d` directory.
>
> This complements the rust-cross-canadian changes, where Rust
> environment setup scripts are installed under a target-specific
> directory. By sourcing only the scripts that match the active target,
> the SDK avoids loading environment settings for other target variants,
> such as mixing 32-bit and 64-bit configurations in multilib SDKs.
>
> Signed-off-by: Harish Sadineni <Harish.Sadineni@windriver.com>
> ---
> meta/classes-recipe/toolchain-scripts.bbclass | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/meta/classes-recipe/toolchain-scripts.bbclass b/meta/classes-recipe/toolchain-scripts.bbclass
> index d94dcdee39..f0f599959d 100644
> --- a/meta/classes-recipe/toolchain-scripts.bbclass
> +++ b/meta/classes-recipe/toolchain-scripts.bbclass
> @@ -76,6 +76,7 @@ toolchain_create_sdk_env_script () {
> echo 'export OECORE_MESON_HOST_CPU_FAMILY="${@meson_cpu_family('TARGET_ARCH', d)}"' >>$script
> echo 'export OECORE_MESON_HOST_CPU="${TARGET_ARCH}"' >>$script
> echo 'export OECORE_MESON_HOST_ENDIAN="${@meson_endian('TARGET', d)}"' >>$script
> + echo 'export OECORE_TARGET_SYS="${TARGET_SYS}"' >> $script
>
> echo 'unset command_not_found_handle' >> $script
>
> @@ -110,6 +111,7 @@ toolchain_create_tree_env_script () {
> echo 'export OECORE_MESON_HOST_CPU_FAMILY="${@meson_cpu_family('TARGET_ARCH', d)}"' >>$script
> echo 'export OECORE_MESON_HOST_CPU="${TARGET_ARCH}"' >>$script
> echo 'export OECORE_MESON_HOST_ENDIAN="${@meson_endian('TARGET', d)}"' >>$script
> + echo 'export OECORE_TARGET_SYS="${TARGET_SYS}"' >> $script
>
> toolchain_shared_env_script
>
> @@ -172,6 +174,12 @@ if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d" ]; then
> . \$envfile
> done
> fi
> +if [ -d "\$OECORE_NATIVE_SYSROOT/environment-setup.d/\$OECORE_TARGET_SYS" ]; then
> + for envfile in \$OECORE_NATIVE_SYSROOT/environment-setup.d/\$OECORE_TARGET_SYS/*.sh; do
> + . \$envfile
> + done
> +fi
> +
> EOF
> }
Thanks to your other emails, I think I finally understand what is going
on here. Sorry for being a bit slow in understanding the issues
involved. I think what has been confusing me is that we have this code
which was meant to handle the target specific scripts:
https://git.openembedded.org/openembedded-core/commit/?id=2d9466734f0c0c90724820bc36992b2800ffa4d0
which I appear to have added in 2014. I can't find any record of
anything actually successfully adding a target environment.d file using
the above layout, everything is nativesdk based as far as I can see.
I'm not even sure it is possible to add such a thing easily.
So your approach is probably the right one but at the same time, we
should probably remove this other confusing one, assuming we can find
nothing installing such scripts. That should reduce the confusion and
code complexity a little.
This does bring one further detail we need to get right, which is the
name of the directory.
The recipe is named: PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
i.e. it regenerates if TARGET_ARCH changes.
You're placing the files in TARGET_SYS, which is not equal to
TARGET_ARCH. Which one is correct? If we build a target which combines
glibc and musl, would we need a different rust-cross-canadian for each
libc?
I suspect PN is wrong and it should also use TARGET_SYS?
The patches in this series also need to be the other way around - add
the search path in first, then use it in the next patch.
Cheers,
Richard
next prev parent reply other threads:[~2026-09-07 21:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 9:31 [PATCH v2 1/3] rust-cross-canadian: install target-specific env scripts and fix rustlib lookup Harish.Sadineni
2026-08-07 9:31 ` [PATCH v2 2/3] toolchain-scripts: source target-specific environment setup scripts Harish.Sadineni
2026-09-07 21:56 ` Richard Purdie [this message]
[not found] ` <18D328AC1287253A.77878@lists.openembedded.org>
2026-09-07 22:10 ` [OE-core] " Richard Purdie
2026-08-07 9:31 ` [PATCH v2 3/3] oeqa/sdk/cases/rust.py: Expand test to verify cargo build builds for target Harish.Sadineni
2026-08-20 8:54 ` [OE-core] [PATCH v2 1/3] rust-cross-canadian: install target-specific env scripts and fix rustlib lookup Richard Purdie
2026-08-21 8:55 ` Harish Sadineni
2026-08-27 17:31 ` Richard Purdie
2026-09-07 18:17 ` Harish Sadineni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19734acbbb01f4ad17ab04a23fd92295b0e5db6f.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=Harish.Sadineni@windriver.com \
--cc=Sundeep.Kokkonda@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.