<?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>12757</bug_id>
          
          <creation_ts>2018-05-22 03:12:58 +0000</creation_ts>
          <short_desc>kernel do_configure fails to use tools in recipe-sysroot-native</short_desc>
          <delta_ts>2018-06-19 14:12:25 +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>kernel</component>
          <version>2.6</version>
          <rep_platform>All</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>critical</bug_severity>
          <target_milestone>2.6 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="He Zhe">zhe.he</reporter>
          <assigned_to name="Bruce Ashfield">bruce.ashfield</assigned_to>
          <cc>randy.macleod</cc>
    
    <cc>tom.zanussi</cc>
    
    <cc>zhenfeng.zhao</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>80626</commentid>
    <comment_count>0</comment_count>
    <who name="He Zhe">zhe.he</who>
    <bug_when>2018-05-22 03:12:58 +0000</bug_when>
    <thetext>ERROR: linux-yocto-dev-4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0 do_configure: Function failed: do_configure (log file is located at /buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/temp/log.do_configure.36193)                                                                         
ERROR: Logfile of failure stored in: /buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/temp/log.do_configure.36193
Log data follows:                                                                
| DEBUG: Executing python function check_oldest_kernel                           
| DEBUG: Python function check_oldest_kernel finished                            
| DEBUG: Executing shell function do_configure                                   
| NOTE: make HOSTCC=gcc  -isystem/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/usr/lib -L/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/lib -Wl,-rpath-link,/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/lib -Wl,-rpath,/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/buildarea/path/build/qemux86-64-poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2 HOSTCPP=gcc  -E -C /buildarea/path/build/qemux86-64-poky/build/tmp/work-shared/qemux86/kernel-source O=/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/linux-qemux86-standard-build oldnoconfig
| make: Entering directory `/buildarea/path/build/qemux86-64-poky/build/tmp/work-shared/qemux86/kernel-source&apos;
| make[1]: Entering directory `/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/linux-qemux86-standard-build&apos;
| arch/x86/Makefile:184: *** Compiler lacks asm-goto support..  Stop.            
| make[1]: Leaving directory `/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/linux-qemux86-standard-build&apos;
| make: *** [sub-make] Error 2                                                   
| make: Leaving directory `/buildarea/path/build/qemux86-64-poky/build/tmp/work-shared/qemux86/kernel-source&apos;
| WARNING: /buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/temp/run.do_configure.36193:1 exit 2 from &apos;make HOSTCC=&quot;gcc  -isystem/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/usr/include -O2 -pipe -L/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/usr/lib -L/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/lib -Wl,-rpath-link,/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/usr/lib -Wl,-rpath-link,/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/lib -Wl,-rpath,/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/usr/lib -Wl,-rpath,/buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/recipe-sysroot-native/lib -Wl,-O1 -Wl,--allow-shlib-undefined -Wl,--dynamic-linker=/buildarea/path/build/qemux86-64-poky/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2&quot; HOSTCPP=&quot;gcc  -E&quot; &quot;$@&quot;&apos;
| ERROR: Function failed: do_configure (log file is located at /buildarea/path/build/qemux86-64-poky/build/tmp/work/qemux86-poky-linux/linux-yocto-dev/4.16-rc++gitAUTOINC+4f7cfac9d0_0edcedd118-r0/temp/log.do_configure.36193)
ERROR: Task (/buildarea/path/poky/meta/recipes-kernel/linux/linux-yocto-dev.bb:do_configure) failed with exit code &apos;1&apos;



Using linux-yocto-dev as virtual/kenrel can cause the above error.
PREFERRED_PROVIDER_virtual/kernel=&quot;linux-yocto-dev&quot;

The latest kernel includes the following commit(linux-yocto-4.12 has not yet). With that, &quot;make oldnoconfig&quot; would run scripts/gcc-goto.sh which runs i586-poky-linux-gcc to check if asm &quot;goto&quot; works well. But i586-poky-linux-gcc is NOT found in this case.

Prepending the following code gcc-goto.sh would show us that every directories in recipe-sysroot-native and recipe-sysroot do not exist at the very time of do_configure running.

But after the error recipe-sysroot-native and recipe-sysroot will have been there.

Tasks dependencies seem defined well.
&quot;linux-yocto-dev.do_configure&quot; -&gt; &quot;linux-yocto-dev.do_prepare_recipe_sysroot&quot;
&quot;linux-yocto-dev.do_prepare_recipe_sysroot&quot; -&gt; &quot;gcc-cross-i586.do_populate_sysroot&quot;

Only if we cleansstate virtual/kernel and rebuild it, can it pass.
This can be reproduced every time.



echo $@ &gt; /tmp/goto.log 2&gt;&amp;1
echo &quot;----------------&quot; &gt;&gt; /tmp/goto.log 2&gt;&amp;1
which i586-poky-linux-gcc &gt;&gt; /tmp/goto.log 2&gt;&amp;1
echo &quot;----------------&quot; &gt;&gt; /tmp/goto.log 2&gt;&amp;1
for i in `echo &quot;$PATH&quot;|sed &apos;s/:/ /g&apos;`;do
        echo $i &gt;&gt; /tmp/goto.log 2&gt;&amp;1
        ls $i &gt;&gt; /tmp/goto.log 2&gt;&amp;1
done
echo &quot;----------------&quot; &gt;&gt; /tmp/goto.log 2&gt;&amp;1
echo &quot;PATH=$PATH&quot; &gt;&gt; /tmp/goto.log 2&gt;&amp;1
echo &quot;----------------&quot; &gt;&gt; /tmp/goto.log 2&gt;&amp;1
cat &lt;&lt; &quot;END&quot; | $@ -x c - -c -o /tmp/a.out &gt;&gt; /tmp/goto.log 2&gt;&amp;1 &amp;&amp; echo &quot;y&quot;




commit e501ce957a786ecd076ea0cfb10b114e6e4d0f40
Author:     Peter Zijlstra &lt;peterz@infradead.org&gt;
AuthorDate: Wed Jan 17 11:42:07 2018 +0100
Commit:     Thomas Gleixner &lt;tglx@linutronix.de&gt;
CommitDate: Tue Mar 20 10:58:02 2018 +0100

    x86: Force asm-goto
    
    We want to start using asm-goto to guarantee the absence of dynamic
    branches (and thus speculation).
    
    A primary prerequisite for this is of course that the compiler
    supports asm-goto. This effecively lifts the minimum GCC version to
    build an x86 kernel to gcc-4.5.
    
    Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
    Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
    Cc: torvalds@linux-foundation.org
    Link: https://lkml.kernel.org/r/20180319201327.GJ4043@hirez.programming.kicks-ass.net</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80656</commentid>
    <comment_count>1</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-05-28 15:19:40 +0000</bug_when>
    <thetext>So what are the steps to reproduce this ?

I&apos;ve obviously been building and booting linux-yocto-dev with each upgrade, and I&apos;m not running into it.

I was able to build and boot today, so does this have to be a completely clean build ?  or some other set of steps ? I&apos;ve tried various clean/distclean steps on linux-yocto-dev.

I think I triggered this once, but can&apos;t anymore .. so I need some steps to reproduce.

root@qemux86-64:~# uname -a
Linux qemux86-64 4.17.0-rc7-yoctodev-standard #1 SMP PREEMPT Mon May 28 15:07:26 UTC 2018 x86_64 GNU/Linux
root@qemux86-64:~#</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80657</commentid>
    <comment_count>2</comment_count>
    <who name="He Zhe">zhe.he</who>
    <bug_when>2018-05-28 16:03:29 +0000</bug_when>
    <thetext>I just tried again. After updating from latest poky, I can still reproduce it by appending the follow line to local.conf. And I got the same output of do_configure error.
PREFERRED_PROVIDER_virtual/kernel = &quot;linux-yocto-dev&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80658</commentid>
    <comment_count>3</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-05-28 16:04:15 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; I just tried again. After updating from latest poky, I can still reproduce
&gt; it by appending the follow line to local.conf. And I got the same output of
&gt; do_configure error.
&gt; PREFERRED_PROVIDER_virtual/kernel = &quot;linux-yocto-dev&quot;

Then we are stumped. Since obviously, that&apos;s the only way to enable linux-yocto-dev, and that&apos;s how I build it as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80671</commentid>
    <comment_count>4</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-05-30 17:21:22 +0000</bug_when>
    <thetext>With this change, I can no longer reproduce the problem.

Can you manually make this change and try a fresh build ?

-----------------

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 68d218584a7e..15b3f326bde7 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -494,7 +494,8 @@ sysroot_stage_all () {
        :
 }
 
-KERNEL_CONFIG_COMMAND ?= &quot;oe_runmake_call -C ${S} O=${B} oldnoconfig&quot;
+KERNEL_CONFIG_COMMAND ?= &quot;oe_runmake_call -C ${S} O=${B} CC=&quot;${KERNEL_CC}&quot; oldnoconfig&quot;
+#KERNEL_CONFIG_COMMAND ?= &quot;oe_runmake_call -C ${S} O=${B} oldnoconfig&quot;
 
 python check_oldest_kernel() {
     oldest_kernel = d.getVar(&apos;OLDEST_KERNEL&apos;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80672</commentid>
    <comment_count>5</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-05-30 19:25:20 +0000</bug_when>
    <thetext>Oops. Sorry, I forgot about the QA error this triggers, do not test it
yet!

Bruce(In reply to comment #4)
&gt; With this change, I can no longer reproduce the problem.
&gt; 
&gt; Can you manually make this change and try a fresh build ?
&gt; 
&gt; -----------------
&gt; 
&gt; diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
&gt; index 68d218584a7e..15b3f326bde7 100644
&gt; --- a/meta/classes/kernel.bbclass
&gt; +++ b/meta/classes/kernel.bbclass
&gt; @@ -494,7 +494,8 @@ sysroot_stage_all () {
&gt;         :
&gt;  }
&gt;  
&gt; -KERNEL_CONFIG_COMMAND ?= &quot;oe_runmake_call -C ${S} O=${B} oldnoconfig&quot;
&gt; +KERNEL_CONFIG_COMMAND ?= &quot;oe_runmake_call -C ${S} O=${B} CC=&quot;${KERNEL_CC}&quot;
&gt; oldnoconfig&quot;
&gt; +#KERNEL_CONFIG_COMMAND ?= &quot;oe_runmake_call -C ${S} O=${B} oldnoconfig&quot;
&gt;  
&gt;  python check_oldest_kernel() {
&gt;      oldest_kernel = d.getVar(&apos;OLDEST_KERNEL&apos;)

Oops. Sorry, I forgot about the QA error this triggers, do not test it
yet!

Bruce</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80677</commentid>
    <comment_count>6</comment_count>
    <who name="He Zhe">zhe.he</who>
    <bug_when>2018-05-31 10:00:43 +0000</bug_when>
    <thetext>Thanks, Bruce. I&apos;ve validated your patch. It works for do_configure.

But I don&apos;t get how it takes effect. In the patch we just overwrite CC with KERNEL_CC which is x86_64-wrs-linux-gcc plus some parameters. CC originally defined in top Makefile is also x86_64-wrs-linux-gcc. How come this overwrite makes x86_64-wrs-linux-gcc available?

Meanwhile I checked the tools in recipe-sysroot-native and recipe-sysroot as did in the first comment, some of them like recipe-sysroot/usr/bin/crossscripts or bison are still unavailable during do_configure. Seems we miss the real bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80678</commentid>
    <comment_count>7</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-05-31 13:06:51 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; Thanks, Bruce. I&apos;ve validated your patch. It works for do_configure.
&gt; 
&gt; But I don&apos;t get how it takes effect. In the patch we just overwrite CC with
&gt; KERNEL_CC which is x86_64-wrs-linux-gcc plus some parameters. CC originally
&gt; defined in top Makefile is also x86_64-wrs-linux-gcc. How come this
&gt; overwrite makes x86_64-wrs-linux-gcc available?
&gt; 
&gt; Meanwhile I checked the tools in recipe-sysroot-native and recipe-sysroot as
&gt; did in the first comment, some of them like
&gt; recipe-sysroot/usr/bin/crossscripts or bison are still unavailable during
&gt; do_configure. Seems we miss the real bug.

That was just a debug/informational patch. From what I was seeing, we were using the host compiler and it was missing the right support. By using that compiler definition, either we get a clear failure or force the sysroot population. That&apos;s the part I&apos;m working on now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80819</commentid>
    <comment_count>8</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2018-06-19 14:12:25 +0000</bug_when>
    <thetext>merged to oe-core rev ff1bdd75d50f0ebac3d599e461685ace29559a82</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>