<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15485</bug_id>
          
          <creation_ts>2024-05-16 06:03:09 +0000</creation_ts>
          <short_desc>meson.cross: wrong host_machine fields in SDK</short_desc>
          <delta_ts>2025-05-19 10:04:11 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>4.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.3 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Toni Lammi">toni.lammi</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
    
    <cc>tim.orling</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>99010</commentid>
    <comment_count>0</comment_count>
    <who name="Toni Lammi">toni.lammi</who>
    <bug_when>2024-05-16 06:03:09 +0000</bug_when>
    <thetext>Meson recipe generates meson.cross.template with
```
[host_machine]
system = &apos;${SDK_OS}&apos;
cpu_family = &apos;${@meson_cpu_family(&quot;SDK_ARCH&quot;, d)}&apos;
cpu = &apos;${SDK_ARCH}&apos;
endian = &apos;${@meson_endian(&quot;SDK&quot;, d)}&apos;
```
Which results in `host_machine.cpu_family()` returning `x86_64` when cross compiling for `aarch64` on `x86_64`.

Looking at Scarthgap it seems the `:class-native` has been fixed but `:class-nativesdk` still produces an invalid config.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99018</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-05-16 14:54:16 +0000</bug_when>
    <thetext>Hello,
Thanks for the report.
Can you send a patch to fix the remaining problems?
Can you also add a test case.

Let me know if you need help.

Rand for the YP bug review</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99019</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-05-16 14:55:26 +0000</bug_when>
    <thetext>Note that the sdk test case &apos;buildepoxy&apos; should be building Meson code already.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99021</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Orling">tim.orling</who>
    <bug_when>2024-05-16 14:57:45 +0000</bug_when>
    <thetext>https://git.yoctoproject.org/poky/tree/meta/lib/oeqa/sdk/cases/buildepoxy.py</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99025</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-05-16 18:54:01 +0000</bug_when>
    <thetext>I dug a little.

The report is correct: the _cross_ file that describes the _host_ (that is, the MACHINE) describes the SDK configuration.

This isn&apos;t trivial to fix (with s/SDK/HOST) because in meson-nativesdk, HOST _is_ SDK.  Instead we need to extend the meson-setup.py which takes the environment configuration and updates the meson.cross file.

The tests work because we don&apos;t verify that Meson is reading the right values, and libepoxy (which is our real world meson test case) doesn&apos;t care.

I have partial changes so far, help testing would be much appreciated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99027</commentid>
    <comment_count>5</comment_count>
    <who name="Toni Lammi">toni.lammi</who>
    <bug_when>2024-05-17 04:21:59 +0000</bug_when>
    <thetext>So if I understood correctly the issue here is that Yocto uses the meson.cross for building for the SDK and then installs that same meson.cross file there?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99028</commentid>
    <comment_count>6</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-05-17 09:09:13 +0000</bug_when>
    <thetext>Not quite - nativesdk-meson ships a meson.cross file but it&apos;s wrong because when that file is created it _cannot_ know what the target is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99030</commentid>
    <comment_count>7</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-05-17 16:32:58 +0000</bug_when>
    <thetext>It needs nicer commit message, but https://git.yoctoproject.org/poky-contrib/log/?h=ross/mesonsdk is what I have so far.  Testing would be appreciated but I believe it works (because I made the test suite check for this).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99032</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-05-20 11:37:59 +0000</bug_when>
    <thetext>Patches on the list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99535</commentid>
    <comment_count>9</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-08-09 10:20:25 +0000</bug_when>
    <thetext>Patches were broken.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101991</commentid>
    <comment_count>10</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2025-05-19 10:04:11 +0000</bug_when>
    <thetext>I think this is fixed with oe-core 0b882df19b5c339d2e7e00f56136afa890404f7b.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>