On Fri, 2020-09-18 at 11:50 +0200, Christian Perkonig via 
lists.openembedded.org wrote:
> meson use to cross compile a cross-file. This file is special for
> every build environment. So if you have a multilib SDK for aarch64
> and arm the cpu_family and the cpu variable in the [HOST]-section
> of the cross-file must be set correctly.
> 
> Currently these variables are statically set to TARGET_ARCH during
> generation of the meson.cross.template file. Now the post-relocate
> scripts sets these variable for every environment.
> 
> Signed-off-by: Christian Perkonig <[email protected]>
> ---
>  meta/recipes-devtools/meson/meson/meson-setup.py      | 11 ++++++++++-
>  meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb |  8 +++++---
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/recipes-devtools/meson/meson/meson-setup.py 
> b/meta/recipes-devtools/meson/meson/meson-setup.py
> index 808e2a062f..a6b716c731 100755
> --- a/meta/recipes-devtools/meson/meson/meson-setup.py
> +++ b/meta/recipes-devtools/meson/meson/meson-setup.py
> @@ -7,6 +7,10 @@ import sys
>  class Template(string.Template):
>      delimiter = "@"
>  
> +
> +class TemplateSingle(string.Template):
> +    delimiter = "@@"
> +
>  class Environ():
>      def __getitem__(self, name):
>          val = os.environ[name]
> @@ -15,6 +19,10 @@ class Environ():
>          val = '[%s]' % val
>          return val
>  
> +class SingleEnv():
> +    def __getitem__(self, name):
> +        return '%s' % os.environ[name]
> +
>  try:
>      sysroot = os.environ['OECORE_NATIVE_SYSROOT']
>  except KeyError:
> @@ -26,6 +34,7 @@ cross_file = os.path.join(sysroot, 
> 'usr/share/meson/%smeson.cross' % os.environ[
>  
>  with open(template_file) as in_file:
>      template = in_file.read()
> -    output = Template(template).substitute(Environ())
> +    s = TemplateSingle(template).substitute(SingleEnv())
> +    output = Template(s).substitute(Environ())
>      with open(cross_file, "w") as out_file:
>          out_file.write(output)
> diff --git a/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb 
> b/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
> index 3c8c4fbc37..67fdd2235d 100644
> --- a/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
> +++ b/meta/recipes-devtools/meson/nativesdk-meson_0.55.1.bb
> @@ -30,6 +30,7 @@ c = @CC
>  cpp = @CXX
>  ar = @AR
>  nm = @NM
> +ld = @LD
>  strip = @STRIP
>  pkgconfig = 'pkg-config'
>  
> @@ -40,10 +41,11 @@ c_link_args = @LDFLAGS
>  cpp_args = @CPPFLAGS
>  cpp_link_args = @LDFLAGS
>  
> +# Host configuration form the meson point of view 
>  [host_machine]
> -system = '${SDK_OS}'
> -cpu_family = '${SDK_ARCH}'
> -cpu = '${SDK_ARCH}'
> +system = '${TARGET_OS}'
> +cpu_family = '@@ARCH'
> +cpu = '@@OECORE_TARGET_ARCH'
>  endian = '${@meson_endian("SDK", d)}'
>  EOF
>  

We can build SDKs where there are multiple different target components.
"nativesdk" components therefore need to be architecture independent.
As far as I can see, this encodes target information into the nativesdk
tooling and is therefore totally incorrect. This would make it a
"cross" tool in Yocto Project terms and nativesdk is not a cross tool.

I don't doubt there are issues here but this patch is therefore not the
right way to fix this. 

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#142902): 
https://lists.openembedded.org/g/openembedded-core/message/142902
Mute This Topic: https://lists.openembedded.org/mt/76927521/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to