[OE-core] [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD

Martin Jansa martin.jansa at gmail.com
Mon Sep 17 05:50:55 UTC 2018


On Fri, Sep 14, 2018 at 03:25:58PM +0200, Martin Jansa wrote:
> This seems to cause nativesdk-glibc failures when DEBUG_BUILD is used, it
> fails like this:
> 
> ../sysdeps/ieee754/ldbl-96/e_jnl.c: In function '__ieee754_jnl':
> ../sysdeps/ieee754/ldbl-96/e_jnl.c:146:20: error: 'temp' may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
>       b = invsqrtpi * temp / sqrtl (x);
>           ~~~~~~~~~~^~~~~~
> 
> the target build suffers from the same, that's why I was using this for a
> while:
> # glibc-2.21 fails to build with:
> # iso-2022-cn-ext.c:501:4: error: 'tmpbuf' may be used uninitialized in
> this function [-Werror=maybe-uninitialized]
> # connections.c:1916:1: error: inlining failed in call to 'clear_db_cache':
> call is unlikely and code size would grow [-Werror=inline]
> # add few -Wno-error like meta/recipes-core/glibc/glibc.inc is trying to
> doin get_optimization function,
> # but fails because we append -Os at the end and -O2 is found first
> SELECTED_OPTIMIZATION_append_pn-glibc =
> "${@bb.utils.contains('TUNE_FEATURES', 'webos-minsize', '
> -Wno-error=maybe-uninitialized -Wno-error=inline', '', d)}"
> 
> 
> There is some logic in meta/recipes-core/glibc/glibc.inc to
> append -Wno-error to SELECTED_OPTIMIZATION when "-O", "-O1", "-Os" is used,
> but the same would be needed for BUILD_OPTIMIZATION now.
> 
> Or maybe it would be worth marking those uninitialized/unused variables
> with #pragma instead of injecting -Wno-error?
> 
> Then we can get rid of:
> python () {
>     opt_effective = "-O"
>     for opt in d.getVar('SELECTED_OPTIMIZATION').split():
>         if opt in ("-O0", "-O", "-O1", "-O2", "-O3", "-Os"):
>             opt_effective = opt
>     if opt_effective == "-O0":
>         bb.fatal("%s can't be built with %s, try -O1 instead" %
> (d.getVar('PN'), opt_effective))
>     if opt_effective in ("-O", "-O1", "-Os"):
>         bb.note("%s doesn't build cleanly with %s, adding -Wno-error to
> SELECTED_OPTIMIZATION" % (d.getVar('PN'), opt_effective))
>         d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
> }
> from meta/recipes-core/glibc/glibc.inc (not use about -O0 case) and remove
> following notes:
> NOTE: glibc doesn't build cleanly with -O, adding -Wno-error to
> SELECTED_OPTIMIZATION
> NOTE: nativesdk-glibc doesn't build cleanly with -O, adding -Wno-error to
> SELECTED_OPTIMIZATION
> from every build with DEBUG_BUILD enabled.
> 
> What would be the preferred fix?

I've sent possible fix here:
http://lists.openembedded.org/pipermail/openembedded-core/2018-September/155744.html

> 
> On Wed, Sep 5, 2018 at 9:05 AM Robert Yang <liezhi.yang at windriver.com>
> wrote:
> 
> > We may also need debug native tools, so make BUILD_OPTIMIZATION respect to
> > DEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't
> > convenient.
> >
> > Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
> > ---
> >  meta/conf/bitbake.conf | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > index dbadeb3..93aee1a 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -612,7 +612,7 @@ FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
> >  DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
> >  SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
> > 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
> >  SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION"
> > -BUILD_OPTIMIZATION = "-O2 -pipe"
> > +BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-O -g
> > -feliminate-unused-debug-types -fno-omit-frame-pointer', '-O2', d)} -pipe"
> >
> >  ##################################################################
> >  # Settings used by bitbake-layers.
> > --
> > 2.7.4
> >
> > --
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core at lists.openembedded.org
> > http://lists.openembedded.org/mailman/listinfo/openembedded-core
> >

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: Digital signature
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20180917/5cd01b1a/attachment-0002.sig>


More information about the Openembedded-core mailing list