<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">This seems to cause nativesdk-glibc failures when DEBUG_BUILD is used, it fails like this:<div><br></div><div><div>../sysdeps/ieee754/ldbl-96/e_jnl.c: In function &#39;__ieee754_jnl&#39;:</div><div>../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: &#39;temp&#39; may be used uninitialized in this function [-Werror=maybe-uninitialized]</div><div>      b = invsqrtpi * temp / sqrtl (x);</div><div>          ~~~~~~~~~~^~~~~~</div></div><div><br></div><div>the target build suffers from the same, that&#39;s why I was using this for a while:</div><div><div># glibc-2.21 fails to build with:</div><div># iso-2022-cn-ext.c:501:4: error: &#39;tmpbuf&#39; may be used uninitialized in this function [-Werror=maybe-uninitialized]</div><div># connections.c:1916:1: error: inlining failed in call to &#39;clear_db_cache&#39;: call is unlikely and code size would grow [-Werror=inline]</div><div># add few -Wno-error like meta/recipes-core/glibc/glibc.inc is trying to doin get_optimization function,</div><div># but fails because we append -Os at the end and -O2 is found first</div><div>SELECTED_OPTIMIZATION_append_pn-glibc = &quot;${@bb.utils.contains(&#39;TUNE_FEATURES&#39;, &#39;webos-minsize&#39;, &#39; -Wno-error=maybe-uninitialized -Wno-error=inline&#39;, &#39;&#39;, d)}&quot;</div></div><div><br></div><div><br></div><div>There is some logic in meta/recipes-core/glibc/glibc.inc to append -Wno-error to SELECTED_OPTIMIZATION when &quot;-O&quot;, &quot;-O1&quot;, &quot;-Os&quot; is used, but the same would be needed for BUILD_OPTIMIZATION now.</div><div><br></div><div>Or maybe it would be worth marking those uninitialized/unused variables with #pragma instead of injecting -Wno-error?</div><div><br></div><div>Then we can get rid of:</div><div><div>python () {</div><div>    opt_effective = &quot;-O&quot;</div><div>    for opt in d.getVar(&#39;SELECTED_OPTIMIZATION&#39;).split():</div><div>        if opt in (&quot;-O0&quot;, &quot;-O&quot;, &quot;-O1&quot;, &quot;-O2&quot;, &quot;-O3&quot;, &quot;-Os&quot;):</div><div>            opt_effective = opt</div><div>    if opt_effective == &quot;-O0&quot;:</div><div>        bb.fatal(&quot;%s can&#39;t be built with %s, try -O1 instead&quot; % (d.getVar(&#39;PN&#39;), opt_effective))</div><div>    if opt_effective in (&quot;-O&quot;, &quot;-O1&quot;, &quot;-Os&quot;):</div><div>        bb.note(&quot;%s doesn&#39;t build cleanly with %s, adding -Wno-error to SELECTED_OPTIMIZATION&quot; % (d.getVar(&#39;PN&#39;), opt_effective))</div><div>        d.appendVar(&quot;SELECTED_OPTIMIZATION&quot;, &quot; -Wno-error&quot;)</div><div>}</div></div><div>from meta/recipes-core/glibc/glibc.inc (not use about -O0 case) and remove following notes:<br></div><div><div>NOTE: glibc doesn&#39;t build cleanly with -O, adding -Wno-error to SELECTED_OPTIMIZATION</div><div>NOTE: nativesdk-glibc doesn&#39;t build cleanly with -O, adding -Wno-error to SELECTED_OPTIMIZATION</div></div><div>from every build with DEBUG_BUILD enabled.</div><div><br></div><div>What would be the preferred fix?</div></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 5, 2018 at 9:05 AM Robert Yang &lt;<a href="mailto:liezhi.yang@windriver.com">liezhi.yang@windriver.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We may also need debug native tools, so make BUILD_OPTIMIZATION respect to<br>
DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn&#39;t<br>
convenient.<br>
<br>
Signed-off-by: Robert Yang &lt;<a href="mailto:liezhi.yang@windriver.com" target="_blank">liezhi.yang@windriver.com</a>&gt;<br>
---<br>
 meta/conf/bitbake.conf | 2 +-<br>
 1 file changed, 1 insertion(+), 1 deletion(-)<br>
<br>
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf<br>
index dbadeb3..93aee1a 100644<br>
--- a/meta/conf/bitbake.conf<br>
+++ b/meta/conf/bitbake.conf<br>
@@ -612,7 +612,7 @@ FULL_OPTIMIZATION = &quot;-O2 -pipe ${DEBUG_FLAGS}&quot;<br>
 DEBUG_OPTIMIZATION = &quot;-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe&quot;<br>
 SELECTED_OPTIMIZATION = &quot;${@d.getVar(oe.utils.vartrue(&#39;DEBUG_BUILD&#39;, &#39;DEBUG_OPTIMIZATION&#39;, &#39;FULL_OPTIMIZATION&#39;, d))}&quot;<br>
 SELECTED_OPTIMIZATION[vardeps] += &quot;FULL_OPTIMIZATION DEBUG_OPTIMIZATION&quot;<br>
-BUILD_OPTIMIZATION = &quot;-O2 -pipe&quot;<br>
+BUILD_OPTIMIZATION = &quot;${@oe.utils.vartrue(&#39;DEBUG_BUILD&#39;, &#39;-O -g -feliminate-unused-debug-types -fno-omit-frame-pointer&#39;, &#39;-O2&#39;, d)} -pipe&quot;<br>
<br>
 ##################################################################<br>
 # Settings used by bitbake-layers.<br>
-- <br>
2.7.4<br>
<br>
-- <br>
_______________________________________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org" target="_blank">Openembedded-core@lists.openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div>