<?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>14927</bug_id>
          
          <creation_ts>2022-10-12 08:52:02 +0000</creation_ts>
          <short_desc>Meson &gt;= 59.0 fails to find Threads dependency using CMake</short_desc>
          <delta_ts>2022-10-13 14:42:38 +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.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Toni Lammi">toni.lammi</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</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>94131</commentid>
    <comment_count>0</comment_count>
    <who name="Toni Lammi">toni.lammi</who>
    <bug_when>2022-10-12 08:52:02 +0000</bug_when>
    <thetext>Meson fails when searching for Threads dependency using cmake:
dependency(&apos;Threads&apos;, method: &apos;cmake&apos;, modules: [&apos;Threads::Threads&apos;])

This issue was likely caused by an update to how Meson manages
CMake dependencies: https://github.com/mesonbuild/meson/pull/8812
See also issue in meson: https://github.com/mesonbuild/meson/issues/10384
The issue only occurs with meson &gt;= 59.0


I studied this issue a bit and found a couple workarounds for this in Yocto:
First one is to modify cmake_toolchain_file in SDK&apos;s meson.cross from
cmake_toolchain_file=&apos;&lt;sdkpath&gt;/usr/share/cmake/OEToolchainConfig.cmake&apos;
to
cmake_toolchain_file=&apos;&lt;sdkpath&gt;/usr/share/cmake/cortexa53-crypto-&lt;distro&gt;-toolchain.cmake&apos;
Another one is to modify OEToolchainConfig.cmake from
file( GLOB toolchain_config_files &quot;${CMAKE_CURRENT_LIST_FILE}.d/*.cmake&quot; )
to
file( GLOB toolchain_config_files &quot;${CMAKE_CURRENT_LIST_DIR}/*toolchain.cmake&quot; )

To me it looks like the SDK&apos;s configuration is a bit off and meson therefore
fails to get the correct information from the environment.

I&apos;m wondering if this behavior is a bug or if I&apos;m doing something wrong here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94135</commentid>
    <comment_count>1</comment_count>
    <who name="Toni Lammi">toni.lammi</who>
    <bug_when>2022-10-12 11:53:55 +0000</bug_when>
    <thetext>Looking at this a bit more and I can see that the cmake_toolchain_file option
comes from our own layer so I think this is not actually an oe-core issue.

It seems that OE-core does not have support for this cmake-meson interoperability
out-of-the-box.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94144</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2022-10-13 14:42:38 +0000</bug_when>
    <thetext>Seems to be specific to Toni&apos;s local layer.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>