<?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>12373</bug_id>
          
          <creation_ts>2017-11-22 02:06:09 +0000</creation_ts>
          <short_desc>Feature Backfilling doesn&apos;t work for multilib</short_desc>
          <delta_ts>2018-03-04 21:13:26 +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>configuration</component>
          <version>2.4</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>High</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.5 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jackie Huang">jackie.huang</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>alex.kanavin</cc>
    
    <cc>jackie.huang</cc>
    
    <cc>mark.hatle</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>stephano</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>78310</commentid>
    <comment_count>0</comment_count>
    <who name="Jackie Huang">jackie.huang</who>
    <bug_when>2017-11-22 02:06:09 +0000</bug_when>
    <thetext>Enabled multilib as the following for qemumips64:

MULTILIB_GLOBAL_VARIANTS_append = &quot; libn32&quot;
MULTILIBS ?= &quot;multilib:lib32 multilib:libn32&quot;
DEFAULTTUNE_virtclass-multilib-lib32 ?= &quot;mips32r2&quot;
DEFAULTTUNE_virtclass-multilib-libn32 ?= &quot;mips64-n32&quot;
require conf/multilib.conf


$ bitbake -e libn32-gobject-introspection | grep &apos;^MACHINE_FEATURES&apos;
MACHINE_FEATURES=&quot;alsa bluetooth usbgadget screen rtc qemu-usermode&quot;
MACHINE_FEATURES_BACKFILL=&quot;rtc qemu-usermode&quot;
MACHINE_FEATURES_BACKFILL_CONSIDERED=&quot; qemu-usermode&quot;

According to the doc:
http://www.yoctoproject.org/docs/2.4/ref-manual/ref-manual.html#ref-features-backfill

The expected result should be:
MACHINE_FEATURES=&quot;alsa bluetooth usbgadget screen rtc&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78311</commentid>
    <comment_count>1</comment_count>
    <who name="Jackie Huang">jackie.huang</who>
    <bug_when>2017-11-22 02:14:32 +0000</bug_when>
    <thetext>The MACHINE_FEATURES_BACKFILL_CONSIDERED is set in meta/conf/machine/include/mips/arch-mips.inc:

# user mode qemu doesn&apos;t support mips64 n32: &quot;Invalid ELF image for this architecture&quot;
MACHINE_FEATURES_BACKFILL_CONSIDERED_append = &quot; ${@bb.utils.contains(&apos;TUNE_FEATURES&apos;, &apos;n32&apos;, &apos;qemu-usermode&apos;, &apos;&apos;, d)}&quot;

But the backfilling is handled in bb.event.ConfigParsed(in base.bbclass):

    if isinstance(e, bb.event.ConfigParsed):
        if not d.getVar(&quot;NATIVELSBSTRING&quot;, False):
            d.setVar(&quot;NATIVELSBSTRING&quot;, lsb_distro_identifier(d))
        d.setVar(&apos;BB_VERSION&apos;, bb.__version__)
        pkgarch_mapping(d)
        oe.utils.features_backfill(&quot;DISTRO_FEATURES&quot;, d)
        oe.utils.features_backfill(&quot;MACHINE_FEATURES&quot;, d)


Which seems to be too early since multilib handler happens in bb.event.RecipePreFinalise.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78420</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2017-11-30 15:58:12 +0000</bug_when>
    <thetext>I believe the issue here is event ordering. I suspect that there are ConfigParsed event handlers in both base.bbclass and multilib and the ordering of them in some cases is incorrect.

Firstly could you confirm if this is an event ordering issue? To test you could add a second event and see whether that resolves the issue.

If that is the problem, we then need to figure out a way to control ordering of event handlers. There is another bug open for that but this would raise its prority. We should discuss what way there may be of doing that on the mailing list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78450</commentid>
    <comment_count>3</comment_count>
    <who name="Jackie Huang">jackie.huang</who>
    <bug_when>2017-12-01 02:10:07 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; I believe the issue here is event ordering. I suspect that there are
&gt; ConfigParsed event handlers in both base.bbclass and multilib and the
&gt; ordering of them in some cases is incorrect.

In multilib, the ConfigParsed event handler is:
multilib_virtclass_handler_vendor[eventmask] = &quot;bb.event.ConfigParsed&quot;

But the DEFAULTTUNE changes is in multilib_virtclass_handler which is RecipePreFinalise event handler.

&gt; 
&gt; Firstly could you confirm if this is an event ordering issue? To test you
&gt; could add a second event and see whether that resolves the issue.

Yes, I can confirm that it&apos;s an event ordering issue. I&apos;m not sure what you mean by
adding a second event, but I tried the following to change the ordering:

1) I changed ConfigParsed to RecipeTaskPreProcess for oe.utils.features_backfill in meta/classes/base.bbclass

-    if isinstance(e, bb.event.ConfigParsed):
+    if isinstance(e, bb.event.RecipePreFinalise):

But it didn&apos;t resolve the issue.

2) Then I changed ConfigParsed to RecipeTaskPreProcess:

-base_eventhandler[eventmask] = &quot;bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.runqueue.sceneQueueComplete bb.event.RecipeParsed&quot;
+base_eventhandler[eventmask] = &quot;bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.runqueue.sceneQueueComplete bb.event.RecipeParsed bb.event.RecipeTaskPreProcess&quot;
 python base_eventhandler() {
     import bb.runqueue

-    if isinstance(e, bb.event.ConfigParsed):
+    if isinstance(e, bb.event.RecipeTaskPreProcess):

And it resolved the issue, but I&apos;m not sure if it&apos;s a proper fix or if it impacts other orderings, I&apos;m going to do some world builds to check.


&gt; 
&gt; If that is the problem, we then need to figure out a way to control ordering
&gt; of event handlers. There is another bug open for that but this would raise

what is the bug id?

&gt; its prority. We should discuss what way there may be of doing that on the
&gt; mailing list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78451</commentid>
    <comment_count>4</comment_count>
    <who name="Jackie Huang">jackie.huang</who>
    <bug_when>2017-12-01 05:39:07 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; I believe the issue here is event ordering. I suspect that there are
&gt; &gt; ConfigParsed event handlers in both base.bbclass and multilib and the
&gt; &gt; ordering of them in some cases is incorrect.
&gt; 
&gt; In multilib, the ConfigParsed event handler is:
&gt; multilib_virtclass_handler_vendor[eventmask] = &quot;bb.event.ConfigParsed&quot;
&gt; 
&gt; But the DEFAULTTUNE changes is in multilib_virtclass_handler which is
&gt; RecipePreFinalise event handler.
&gt; 
&gt; &gt; 
&gt; &gt; Firstly could you confirm if this is an event ordering issue? To test you
&gt; &gt; could add a second event and see whether that resolves the issue.
&gt; 
&gt; Yes, I can confirm that it&apos;s an event ordering issue. I&apos;m not sure what you
&gt; mean by
&gt; adding a second event, but I tried the following to change the ordering:
&gt; 
&gt; 1) I changed ConfigParsed to RecipeTaskPreProcess for
&gt; oe.utils.features_backfill in meta/classes/base.bbclass
&gt; 
&gt; -    if isinstance(e, bb.event.ConfigParsed):
&gt; +    if isinstance(e, bb.event.RecipePreFinalise):
&gt; 
&gt; But it didn&apos;t resolve the issue.
&gt; 
&gt; 2) Then I changed ConfigParsed to RecipeTaskPreProcess:
&gt; 
&gt; -base_eventhandler[eventmask] = &quot;bb.event.ConfigParsed
&gt; bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise
&gt; bb.runqueue.sceneQueueComplete bb.event.RecipeParsed&quot;
&gt; +base_eventhandler[eventmask] = &quot;bb.event.ConfigParsed
&gt; bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise
&gt; bb.runqueue.sceneQueueComplete bb.event.RecipeParsed
&gt; bb.event.RecipeTaskPreProcess&quot;
&gt;  python base_eventhandler() {
&gt;      import bb.runqueue
&gt; 
&gt; -    if isinstance(e, bb.event.ConfigParsed):
&gt; +    if isinstance(e, bb.event.RecipeTaskPreProcess):
&gt; 
&gt; And it resolved the issue, but I&apos;m not sure if it&apos;s a proper fix or if it
&gt; impacts other orderings, I&apos;m going to do some world builds to check.

This causes error:
bluez5 was skipped: missing required distro feature &apos;bluez5&apos; (not in DISTRO_FEATURES)

So it&apos;s not a proper fix and impact other orderings.

&gt; 
&gt; 
&gt; &gt; 
&gt; &gt; If that is the problem, we then need to figure out a way to control ordering
&gt; &gt; of event handlers. There is another bug open for that but this would raise
&gt; 
&gt; what is the bug id?
&gt; 
&gt; &gt; its prority. We should discuss what way there may be of doing that on the
&gt; &gt; mailing list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78498</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2017-12-04 19:56:56 +0000</bug_when>
    <thetext>Richard asked us to work on how to resolve this multilib problem with him simply providing guidance. I&apos;ve assigned it to Robert and we&apos;ll talk about how to proceed then update the defect with our proposed fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78502</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2017-12-04 21:25:06 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; Firstly could you confirm if this is an event ordering issue? To test you
&gt; &gt; could add a second event and see whether that resolves the issue.
&gt; 
&gt; Yes, I can confirm that it&apos;s an event ordering issue. I&apos;m not sure what you
&gt; mean by
&gt; adding a second event, but I tried the following to change the ordering:

In cookerdata.py there is the line:

bb.event.fire(bb.event.ConfigParsed(), self.data)

so you could add:

bb.event.fire(bb.event.ConfigParsed2(), self.data)

(adding a copy of bb.event.ConfigParsed as ConfigParsed2)

immediately after it which would add a second event (or add en event before). If that fixed the problem, we&apos;d confirm its event ordering.

&gt; &gt; If that is the problem, we then need to figure out a way to control ordering
&gt; &gt; of event handlers. There is another bug open for that but this would raise
&gt; 
&gt; what is the bug id?

5709, I added it as a dependency of this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78533</commentid>
    <comment_count>7</comment_count>
    <who name="Jackie Huang">jackie.huang</who>
    <bug_when>2017-12-06 07:53:58 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #3)
&gt; &gt; (In reply to comment #2)
&gt; &gt; &gt; Firstly could you confirm if this is an event ordering issue? To test you
&gt; &gt; &gt; could add a second event and see whether that resolves the issue.
&gt; &gt; 
&gt; &gt; Yes, I can confirm that it&apos;s an event ordering issue. I&apos;m not sure what you
&gt; &gt; mean by
&gt; &gt; adding a second event, but I tried the following to change the ordering:
&gt; 
&gt; In cookerdata.py there is the line:
&gt; 
&gt; bb.event.fire(bb.event.ConfigParsed(), self.data)
&gt; 
&gt; so you could add:
&gt; 
&gt; bb.event.fire(bb.event.ConfigParsed2(), self.data)
&gt; 
&gt; (adding a copy of bb.event.ConfigParsed as ConfigParsed2)
&gt; 
&gt; immediately after it which would add a second event (or add en event
&gt; before). If that fixed the problem, we&apos;d confirm its event ordering.

Unfortunately it can not fix the problem, I think it&apos;s not only an ordering issue.

&gt; 
&gt; &gt; &gt; If that is the problem, we then need to figure out a way to control ordering
&gt; &gt; &gt; of event handlers. There is another bug open for that but this would raise
&gt; &gt; 
&gt; &gt; what is the bug id?
&gt; 
&gt; 5709, I added it as a dependency of this bug.

The bug is about controlling handlers order in the same event, right?

But the issue here is:
features_backfill happens in bb.event.ConfigParsed, multilib_virtclass_handler happens in bb.event.RecipePreFinalise which seems to be after bb.event.ConfigParsed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78562</commentid>
    <comment_count>8</comment_count>
    <who name="Jackie Huang">jackie.huang</who>
    <bug_when>2017-12-07 02:41:26 +0000</bug_when>
    <thetext>I sent a patch for this:
https://patchwork.openembedded.org/series/10104/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79680</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2018-03-03 17:13:20 +0000</bug_when>
    <thetext>The approach in this patch has always felt like a hack/workaround. After experimentation I&apos;ve concluded we should fix bitbake -e to handle anonymous python, then we can move the backfilling to anonymous python and the problematic multilib issue should be resolved. I&apos;ve sent patches to bitbake and OE-Core.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79683</commentid>
    <comment_count>10</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2018-03-04 21:13:26 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=c2381e3a69ecff28d19beb18f4a0037a6ba40352
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=20a93757a3c9d7d61eec209577ed3bfb03543198
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=be4c9df542ef53be4169396517aef0b3873e850b
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=1a992fd41861a30f1359169a83c16e99611a3e50</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>