Add oe.utils.vartrue() and update BUILD_OPTIMIZATION
v2 cover Add oe.utils.vartrue() and update BUILD_OPTIMIZATION
* V2:
- Improve readability as RP and Peter suggested.
* V1:
Initial version
// Robert
The following changes since commit bd92ff5759809df2542ce1bcba2c45bbd11d1e10:
openssl: Handle -conf package file conflicts (2018-09-04 11:03:31 +0100)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib rbt/debug
http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/debug
Robert Yang (2):
oe/utils.py: Add vartrue()
bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
meta/conf/bitbake.conf | 4 ++-- meta/lib/oe/utils.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 oe/utils.py: Add vartrue()
It can be used to simplify code like:
"${@['iffalse', 'iftrue'][var]}"
--- meta/conf/bitbake.conf | 2 +- meta/lib/oe/utils.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
@@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}" # Disabled until the option works properly -feliminate-dwarf2-dups FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}" DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe" -SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}" +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"
meta/lib/oe/utils.py +7 -0
@@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed): msg = msg + ' (%s)' % self.description return msg + +def vartrue(var, iftrue, iffalse, d): + import oe.types + if oe.types.boolean(d.getVar(var)): + return iftrue + else: + return iffalse
Signature · 1 line
2.7.4
Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
Quoted 38 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Robert Yang
Sent: den 5 september 2018 09:16
To: [email protected]
Subject: [OE-core] [PATCH 1/2 V2]oe/utils.py: Addvartrue()It can be used to simplify code like:
"${@['iffalse', 'iftrue'][var]}"Signed-off-by Robert Yang <[email protected]>--- meta/conf/bitbake.conf | 2 +- meta/lib/oe/utils.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)meta/conf/bitbake.conf +0
-0@@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types${DEBUG_PREFIX_MAP}"
# Disabled until the option works properly -feliminate-dwarf2-dupsFULL_OPTIMIZATION= "-O2 -pipe ${DEBUG_FLAGS}"DEBUG_OPTIMIZATION= "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
-SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}" +SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATIONDEBUG_OPTIMIZATION"
BUILD_OPTIMIZATION= "-O2 -pipe"meta/lib/oe/utils.py +0
-0
meta/lib/oe/utils.py class ImageQAFailed(bb.build.FuncFailed): · line 473
Quoted 10 lines
meta/lib/oe/utils.py +7
-0@@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed): msg = msg + ' (%s)' % self.description return msg + +def vartrue(var, iftrue, iffalse, d): + import oe.types + if oe.types.boolean(d.getVar(var)): + return iftrue + else: + return iffalse
Put it together with ifelse() and conditional() instead, where it better belongs.
You can also implement it as:
def vartrue(var, iftrue, iffalse, d):
import oe.types
return oe.utils.ifelse(oe.types.boolean(d.getVar(var), iftrue, iffalse):
Quoted 2 lines
--
2.7.4
//Peter
Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
Hi Peter,
Quoted 52 lines · Peter Kjellerstedt
Quoted 38 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Robert Yang
Sent: den 5 september 2018 09:16
To: [email protected]
Subject: [OE-core] [PATCH 1/2 V2]oe/utils.py: Addvartrue()It can be used to simplify code like:
"${@['iffalse', 'iftrue'][var]}"Signed-off-by Robert Yang <[email protected]>--- meta/conf/bitbake.conf | 2 +- meta/lib/oe/utils.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)meta/conf/bitbake.conf +0
-0@@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types${DEBUG_PREFIX_MAP}"
# Disabled until the option works properly -feliminate-dwarf2-dupsFULL_OPTIMIZATION= "-O2 -pipe ${DEBUG_FLAGS}"DEBUG_OPTIMIZATION= "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
-SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}" +SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATIONDEBUG_OPTIMIZATION"
BUILD_OPTIMIZATION= "-O2 -pipe"meta/lib/oe/utils.py +0
-0meta/lib/oe/utils.py class ImageQAFailed(bb.build.FuncFailed): · line 473
Quoted 10 lines
meta/lib/oe/utils.py +7
-0@@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed): msg = msg + ' (%s)' % self.description return msg + +def vartrue(var, iftrue, iffalse, d): + import oe.types + if oe.types.boolean(d.getVar(var)): + return iftrue + else: + return iffalsePut it together with
ifelse()andconditional()instead, where it better belongs.
Quoted 5 lines
You can also implement it as:
def
vartrue(var, iftrue, iffalse, d):
import oe.types
return oe.utils.ifelse(oe.types.boolean(d.getVar(var), iftrue, iffalse):
Then we need import oe.utils, and I don't think that it's easier to read than:
+
+def vartrue(var, iftrue, iffalse, d):
+ import oe.types
+ if oe.types.boolean(d.getVar(var)):
+ return iftrue
+ else:
+ return iffalse
// Robert
Quoted 7 lines
Quoted 3 lines
--
2.7.4//Peter
Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
Quoted 66 lines
-----Original Message-----
From: Robert Yang <[email protected]>
Sent: den 5 september 2018 10:12
To: Peter Kjellerstedt <[email protected]>; openembedded- [email protected]
Subject: Re: [OE-core] [PATCH 1/2 V2]oe/utils.py: Addvartrue()Hi Peter,
Quoted 2 lines · Peter Kjellerstedt
Quoted 2 lines
-----Original Message-----
From: [email protected]<openembedded-
Quoted 14 lines
Quoted 14 lines
[email protected]> On Behalf Of Robert Yang
Sent: den 5 september 2018 09:16
To: [email protected]
Subject: [OE-core] [PATCH 1/2 V2]oe/utils.py: Addvartrue()It can be used to simplify code like:
"${@['iffalse', 'iftrue'][var]}"Signed-off-by Robert Yang <[email protected]>--- meta/conf/bitbake.conf | 2 +- meta/lib/oe/utils.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)Quoted 5 lines
meta/conf/bitbake.conf DEBUG_FLAGS ?= "-g -feliminate-unused-debug-
Quoted 5 lines
meta/conf/bitbake.conf +0
-0@@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types
Quoted 4 lines
Quoted 4 lines
${DEBUG_PREFIX_MAP}"
# Disabled until the option works properly -feliminate-dwarf2-dupsFULL_OPTIMIZATION= "-O2 -pipe ${DEBUG_FLAGS}"DEBUG_OPTIMIZATION= "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe"
Quoted 3 lines
Quoted 3 lines
-SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}" +SELECTED_OPTIMIZATION =
"${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
Quoted 24 lines
Quoted 10 lines
'
DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATIONDEBUG_OPTIMIZATION"
BUILD_OPTIMIZATION= "-O2 -pipe"meta/lib/oe/utils.py +0
-0meta/lib/oe/utils.py class ImageQAFailed(bb.build.FuncFailed): · line 473
Quoted 10 lines
meta/lib/oe/utils.py +7
-0@@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed): msg = msg + ' (%s)' % self.description return msg + +def vartrue(var, iftrue, iffalse, d): + import oe.types + if oe.types.boolean(d.getVar(var)): + return iftrue + else: + return iffalsePut it together with
ifelse()andconditional()instead, where it better belongs.
Quoted 8 lines
Quoted 5 lines
You can also implement it as:
def
vartrue(var, iftrue, iffalse, d):
import oe.types
return oe.utils.ifelse(oe.types.boolean(d.getVar(var), iftrue, iffalse):Then we need import oe.utils, and I don't think that it's easier to read than:
Well, since this file actually is oe.utils, I would assume that is not needed (other functions in this file call oe.utils functions just fine).
Quoted 8 lines
meta/lib/oe/utils.py +7
-0+ +def vartrue(var, iftrue, iffalse, d): + import oe.types + if oe.types.boolean(d.getVar(var)): + return iftrue + else: + return iffalse
Quoted 7 lines
// Robert
Quoted 5 lines
Quoted 3 lines
--
2.7.4//Peter
//Peter
Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
In reply to Robert YangQuoted 16 lines · Robert Yang
Quoted 11 lines · Peter Kjellerstedt
Quoted 1 line
Put it together with
ifelse()andconditional()instead, where it better
belongs.You can also implement it as:
def
vartrue(var, iftrue, iffalse, d):
import oe.types
return oe.utils.ifelse(oe.types.boolean(d.getVar(var), iftrue,
iffalse):Then we need import oe.utils, and I don't think that it's easier to read than:
meta/lib/oe/utils.py class ImageQAFailed(bb.build.FuncFailed): · line 473
Quoted 7 lines
meta/lib/oe/utils.py +7
-0+ +def vartrue(var, iftrue, iffalse, d): + import oe.types + if oe.types.boolean(d.getVar(var)): + return iftrue + else: + return iffalse
I think Robert's version is easier to read, the addition of the other function doesn't really add much. It probably should live alongside the other varients in the file though.
Cheers,
Richard
Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
In reply to Robert YangQuoted 27 lines · Robert Yang
It can be used to simplify code like:
"${@['iffalse', 'iftrue'][var]}"Signed-off-by Robert Yang <[email protected]>--- meta/conf/bitbake.conf | 2 +- meta/lib/oe/utils.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)meta/conf/bitbake.conf +1
-1@@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}" # Disabled until the option works properly -feliminate-dwarf2-dups FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}" DEBUG_OPTIMIZATION = "-O -fno-omit-frame-pointer ${DEBUG_FLAGS} -pipe" -SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION', 'DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}" +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"meta/lib/oe/utils.py +0
-0
meta/lib/oe/utils.py class ImageQAFailed(bb.build.FuncFailed): · line 473
Quoted 10 lines
meta/lib/oe/utils.py +7
-0@@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed): msg = msg + ' (%s)' % self.description return msg + +def vartrue(var, iftrue, iffalse, d): + import oe.types + if oe.types.boolean(d.getVar(var)): + return iftrue + else: + return iffalse
Shouldn't we update bitbake to track var usage like in oe.utils.conditional:
http://git.openembedded.org/bitbake/commit/?id=5156b4bb6876dac636be9726df22c8ee792714dd
before this gets used more widely?
Quoted 8 lines
Signature · 7 lines
2.7.4 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Re: [PATCH 1/2 V2] oe/utils.py: Add vartrue()
Quoted 35 lines · Martin Jansa
Quoted 34 lines · Robert Yang
It can be used to simplify code like:
"${@['iffalse', 'iftrue'][var]}"Signed-off-by Robert Yang <[email protected]>--- meta/conf/bitbake.conf | 2 +- meta/lib/oe/utils.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-)meta/conf/bitbake.conf +0
-0@@ -610,7 +610,7 @@ DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
# Disabled until the option works properly -feliminate-dwarf2-dupsFULL_OPTIMIZATION= "-O2 -pipe ${DEBUG_FLAGS}"DEBUG_OPTIMIZATION= "-O -fno-omit-frame-pointer ${DEBUG_FLAGS}meta/conf/bitbake.conf +0
-2-pipe" -SELECTED_OPTIMIZATION = "${@d.getVar(['FULL_OPTIMIZATION','DEBUG_OPTIMIZATION'][d.getVar('DEBUG_BUILD') == '1'])}" +SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD ', '
DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATIONDEBUG_OPTIMIZATION"
BUILD_OPTIMIZATION= "-O2 -pipe"meta/lib/oe/utils.py +0
-0@@ -464,3 +464,10 @@ class ImageQAFailed(bb.build.FuncFailed): msg = msg + ' (%s)' % self.description
Quoted 14 lines
meta/lib/oe/utils.py class ImageQAFailed(bb.build.FuncFailed): · line 473
Quoted 8 lines
meta/lib/oe/utils.py +7
-0return msg + +def vartrue(var, iftrue, iffalse, d): + import oe.types + if oe.types.boolean(d.getVar(var)): + return iftrue + else: + return iffalseShouldn't we update bitbake to track var usage like in oe.utils.conditional:
http://git.openembedded.org/bitbake/commit/?id=5156b4bb6876dac636be9726df22c8ee792714dd
before this gets used more widely?
I think we need to take a step back and make sure we have the right APIs for this before we go adding more magic to bitbake variable tracking. There are two sides to it, the conditional expressions and the variable typing. Something to look at in 2.7.
I really want to add more OE namespace functions directly into the bitbake datastore code.
Cheers,
Richard
PATCH v2 2/2 bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
In reply to Robert YangWe 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.
--- meta/conf/bitbake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
@@ -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.
Signature · 1 line
2.7.4
Re: [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
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 toSELECTED_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?
Quoted 33 lines · Robert Yang
We may also need debug native tools, so make
BUILD_OPTIMIZATIONrespect toDEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't convenient.Signed-off-by Robert Yang <[email protected]>--- meta/conf/bitbake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)meta/conf/bitbake.conf +0
-0@@ -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_OPTIMIZATIONDEBUG_OPTIMIZATION"meta/conf/bitbake.conf +1
-3-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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
Quoted 53 lines · Martin Jansa
This seems to cause nativesdk-glibc failures when
DEBUG_BUILDis 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_OPTIMIZATIONwhen "-O", "-O1", "-Os" is used, but the same would be needed forBUILD_OPTIMIZATIONnow.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
ifopt_effective== "-O0":
bb.fatal("%s can't be built with %s, try -O1 instead" %
(d.getVar('PN'),opt_effective))
ifopt_effectivein ("-O", "-O1", "-Os"):
bb.note("%s doesn't build cleanly with %s, adding -Wno-error toSELECTED_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 toSELECTED_OPTIMIZATION
NOTE: nativesdk-glibc doesn't build cleanly with -O, adding -Wno-error toSELECTED_OPTIMIZATION
from every build withDEBUG_BUILDenabled.
Quoted 1 line
What would be the preferred fix?
I've sent possible fix here:
http://lists.openembedded.org/pipermail/openembedded-core/2018-September/155744.html
Quoted 37 lines
Quoted 33 lines · Robert Yang
We may also need debug native tools, so make
BUILD_OPTIMIZATIONrespect toDEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't convenient.Signed-off-by Robert Yang <[email protected]>--- meta/conf/bitbake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)meta/conf/bitbake.conf +0
-0@@ -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_OPTIMIZATIONDEBUG_OPTIMIZATION"meta/conf/bitbake.conf +1
-3-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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Re: [PATCH 2/2 V2] bitbake.conf: Make BUILD_OPTIMIZATION respect to DEBUG_BUILD
Quoted 54 lines · Martin Jansa
Quoted 53 lines · Martin Jansa
This seems to cause nativesdk-glibc failures when
DEBUG_BUILDis 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_OPTIMIZATIONwhen "-O", "-O1", "-Os" is used, but the same would be needed forBUILD_OPTIMIZATIONnow.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
ifopt_effective== "-O0":
bb.fatal("%s can't be built with %s, try -O1 instead" %
(d.getVar('PN'),opt_effective))
ifopt_effectivein ("-O", "-O1", "-Os"):
bb.note("%s doesn't build cleanly with %s, adding -Wno-error toSELECTED_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 toSELECTED_OPTIMIZATION
NOTE: nativesdk-glibc doesn't build cleanly with -O, adding -Wno-error toSELECTED_OPTIMIZATION
from every build withDEBUG_BUILDenabled.
Quoted 4 lines
Quoted 1 line
What would be the preferred fix?
I've sent possible fix here:
http://lists.openembedded.org/pipermail/openembedded-core/2018-September/155744.html
Thanks, it seems the right fix to me.
// Robert
Quoted 39 lines
Quoted 38 lines
Quoted 33 lines · Robert Yang
We may also need debug native tools, so make
BUILD_OPTIMIZATIONrespect toDEBUG_BUILD, otherwise, we need set CFLAGS in the recipe which isn't convenient.Signed-off-by Robert Yang <[email protected]>--- meta/conf/bitbake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)meta/conf/bitbake.conf +0
-0@@ -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_OPTIMIZATIONDEBUG_OPTIMIZATION"meta/conf/bitbake.conf +1
-3-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
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core