<?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>15992</bug_id>
          
          <creation_ts>2025-10-09 17:04:04 +0000</creation_ts>
          <short_desc>Unexpected behaviour with TOOLCHAIN</short_desc>
          <delta_ts>2026-03-12 15:14:14 +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>5.2</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 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>antonin.godard</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>raj.khem</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>102900</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2025-10-09 17:04:04 +0000</bug_when>
    <thetext>If I set TOOLCHAIN=clang in local.conf and then build a native recipe, the overrides that are used as not quite as expected:

$ bitbake-getvar -r gn-native --value OVERRIDES
linux:aarch64:pn-gn-native:layer-core::poky:class-native:toolchain-clang:forcevariable

Specifically, &quot;toolchain-clang&quot; is unexpected because the build will be using the host GCC.

I suspect the answer is &quot;set PREFERRED_TOOLCHAIN instead&quot;, which is fine. But should native.bbclass be setting TOOLCHAIN=TOOLCHAIN_NATIVE too?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102901</commentid>
    <comment_count>1</comment_count>
    <who name="Khem Raj">raj.khem</who>
    <bug_when>2025-10-09 20:23:10 +0000</bug_when>
    <thetext>(In reply to Ross Burton from comment #0)
&gt; If I set TOOLCHAIN=clang in local.conf and then build a native recipe, the
&gt; overrides that are used as not quite as expected:
&gt; 
&gt; $ bitbake-getvar -r gn-native --value OVERRIDES
&gt; linux:aarch64:pn-gn-native:layer-core::poky:class-native:toolchain-clang:
&gt; forcevariable
&gt; 
&gt; Specifically, &quot;toolchain-clang&quot; is unexpected because the build will be
&gt; using the host GCC.
&gt;

PREFERRED_TOOLCHAIN_{TARGET|NATIVE|SDK} are new interfaces
 
&gt; I suspect the answer is &quot;set PREFERRED_TOOLCHAIN instead&quot;, which is fine.
&gt; But should native.bbclass be setting TOOLCHAIN=TOOLCHAIN_NATIVE too?

yeah perhaps might be ok, I also wonder if we have similar issue with SDK case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102956</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2025-10-16 14:39:37 +0000</bug_when>
    <thetext>We should at least have something in the migration guide about this. We should say that clang has been integrated into core, meta-clang is no longer essential, but when picking a compiler at a distro level PREFERRED_TOOLCHAIN should be used instead of TOOLCHAIN.

Antonin, can you add something like that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102971</commentid>
    <comment_count>3</comment_count>
    <who name="Antonin Godard">antonin.godard</who>
    <bug_when>2025-10-16 15:18:05 +0000</bug_when>
    <thetext>I added a note on that to the release note updates I sent today:

&gt;     .. warning::
&gt;        The :term:`TOOLCHAIN` should **not** be set globally. For overridding
&gt;        the toolchain globally, use :term:`PREFERRED_TOOLCHAIN_TARGET`,
&gt;        :term:`PREFERRED_TOOLCHAIN_NATIVE` and :term:`PREFERRED_TOOLCHAIN_SDK`.

(I realize now I&apos;m missing &quot;variable&quot; after TOOLCHAIN, will fix that)

https://lore.kernel.org/yocto-docs/20251016-release-note-5-3-second-hunk-v1-17-20f21db1f93c@bootlin.com/

Do you think that&apos;s enough or should I mention something else?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>104609</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2026-03-12 15:14:14 +0000</bug_when>
    <thetext>The doc changes look good.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>