On Fri, 2026-08-07 at 02:31 -0700, Sadineni, Harish via lists.openembedded.org 
wrote:
> From: Harish Sadineni <[email protected]>
> 
> 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 <[email protected]>
> ---
>  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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#245308): 
https://lists.openembedded.org/g/openembedded-core/message/245308
Mute This Topic: https://lists.openembedded.org/mt/120640030/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to