From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Hongxu Jia <hongxu.jia@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 0/4] base/bbclass: use target path to replace build ones in debugging info
Date: Fri, 29 Jan 2016 06:40:30 +0000 [thread overview]
Message-ID: <1454049630.10340.60.camel@linuxfoundation.org> (raw)
In-Reply-To: <56AADEEB.6050106@windriver.com>
On Fri, 2016-01-29 at 11:39 +0800, Hongxu Jia wrote:
> On 01/29/2016 01:04 AM, Richard Purdie wrote:
> > On Thu, 2016-01-28 at 10:58 +0800, Hongxu Jia wrote:
> > > On 01/28/2016 06:13 AM, Richard Purdie wrote:
> > > > On Wed, 2016-01-27 at 14:34 -0500, Khem Raj wrote:
> > > > > > On Jan 27, 2016, at 5:16 AM, Richard Purdie <
> > > > > > richard.purdie@linuxfoundation.org> wrote:
> > > > > >
> > > > > > I like the idea of this a lot, I think it makes sense
> > > > > > however
> > > > > > why
> > > > > > not
> > > My original trying was just added them here, but the variable
> > > parsing
> > > at here is too early, the ${BPN}, ${B} and {S} was assigned with
> > > 'defaultpkgname' at this time. Which we have:
> > > ...
> > > > -fdebug-prefix-map=/buildarea/raid0/hjia/build-20160127-yocto
> > > > -buildpath-2/
> > > tmp/work/core2-64-poky-linux/defaultpkgname/1.0-r0/defaultpkgname
> > > -1.0=
> > > /usr/src/defaultpkgname
> >
> > I think this is just from your debugging technique. By the time
> > these
> > are used in recipes, they will have the correct value for these
> > variables. Expansion happens late, not when the line is parsed.
>
> For var DEBUG_FLAGS, it indeed has correct value at last, but the
> CFLAGS
> and TARGET_CFLAGS was expanded when DEBUG_FLAGS has 'defaultpkgname'
>
> The CFLAGS and TARGET_CFLAGS is shell variables (export CFLAGS=), it
> seems shell variable is expanded only once.
>
> >
> > Can you be more specific about how you tested this and the problem
> > you
> > saw?
>
> 1. Modify bitbake.conf
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index e80ee18..3ddb9e8 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -546,7 +546,14 @@ EXTRA_OEMAKE_prepend_task-install =
> "${PARALLEL_MAKEINST} "
> ##################################################################
> # Optimization flags.
> ##################################################################
> -DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types"
> +DEBUG_FLAGS ?= "-g \
> + -feliminate-unused-debug-types \
> + -fdebug-prefix-map=${B}=/usr/src/${BPN} \
> + -fdebug-prefix-map=${S}=/usr/src/${BPN} \
> + -gno-record-gcc-switches \
> + -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
> + -fdebug-prefix-map=${STAGING_DIR_HOST}= \
> +"
>
> 2. Build lib32-glibc, there are still buildpath QA Warnings
I investigated this a little. When I tried your patch I saw:
$ bitbake glibc -e | grep TARGET_CFLAGS=
export TARGET_CFLAGS="
-I/media/build1/poky/build/tmp5/sysroots/qemux86/usr/include -O2 -pipe
-g -feliminate-unused-debug-types -fdebug-prefix
-map=/media/build1/poky/build/tmp5/work/i586-poky
-linux/defaultpkgname/1.0-r0/defaultpkgname-1.0=/usr/src/defaultpkgname
-fdebug-prefix-map=/media/build1/poky/build/tmp5/work/i586-poky
-linux/defaultpkgname/1.0-r0/defaultpkgname-1.0=/usr/src/defaultpkgname
-gno-record-gcc-switches -fdebug-prefix
-map=/media/build1/poky/build/tmp5/sysroots/x86_64-linux= -fdebug
-prefix-map=/media/build1/poky/build/tmp5/sysroots/qemux86= "
and then once I commented out:
SELECTED_OPTIMIZATION := "${@get_optimization(d)}"
in glibc.inc I see:
$ bitbake glibc -e | grep TARGET_CFLAGS=
export TARGET_CFLAGS="
-I/media/build1/poky/build/tmp5/sysroots/qemux86/usr/include -O2 -pipe
-g -feliminate-unused-debug-types -fdebug-prefix
-map=/media/build1/poky/build/tmp5/work/i586-poky-linux/glibc/2.22
-r0/build-i586-poky-linux=/usr/src/glibc -fdebug-prefix
-map=/media/build1/poky/build/tmp5/work/i586-poky-linux/glibc/2.22
-r0/git=/usr/src/glibc -gno-record-gcc-switches -fdebug-prefix
-map=/media/build1/poky/build/tmp5/sysroots/x86_64-linux= -fdebug
-prefix-map=/media/build1/poky/build/tmp5/sysroots/qemux86= "
I'd much prefer to fix glibc.inc and put the entries in bitbake.conf
than further complicate the variables unnecessarily.
For example, we could do:
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
index 17fa2d5..8e62b3a 100644
--- a/meta/recipes-core/glibc/glibc.inc
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -10,25 +10,20 @@ TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
# glibc can't be built without optimization, if someone tries to compile an
# entire image as -O0, we override it with -O2 here and give a note about it.
-def get_optimization(d):
+python () {
selected_optimization = d.getVar("SELECTED_OPTIMIZATION", True)
- if bb.utils.contains("SELECTED_OPTIMIZATION", "-O2", "x", "", d) == "x":
- return selected_optimization
- elif bb.utils.contains("SELECTED_OPTIMIZATION", "-O", "x", "", d) == "x":
+ if bb.utils.contains("SELECTED_OPTIMIZATION", "-O", "x", "", d) == "x":
bb.note("glibc can't be built with -O, -O -Wno-error will be used instead.")
- return selected_optimization.replace("-O", "-O -Wno-error")
+ d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
elif bb.utils.contains("SELECTED_OPTIMIZATION", "-O0", "x", "", d) == "x":
- bb.note("glibc can't be built with -O0, -O2 will be used instead.")
- return selected_optimization.replace("-O0", "-O2")
+ bb.fatal("glibc can't be built with -O0, using -O1 -Wno-error or -O1 instead.")
elif bb.utils.contains("SELECTED_OPTIMIZATION", "-Os", "x", "", d) == "x":
bb.note("glibc can't be built with -Os, -Os -Wno-error will be used instead.")
- return selected_optimization.replace("-Os", "-Os -Wno-error")
+ d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
elif bb.utils.contains("SELECTED_OPTIMIZATION", "-O1", "x", "", d) == "x":
bb.note("glibc can't be built with -O1, -O1 -Wno-error will be used instead.")
- return selected_optimization.replace("-O1", "-O1 -Wno-error")
- return selected_optimization
-
-SELECTED_OPTIMIZATION := "${@get_optimization(d)}"
+ d.appendVar("SELECTED_OPTIMIZATION", " -Wno-error")
+}
# siteconfig.bbclass runs configure which needs a working compiler
# For the compiler to work we need a working libc yet libc isn't
which will now give an error for -O0 but I think that is reasonable.
I'd even prefer to drop the above entirely and use bitbake.conf to be
honest but I know some people insisted we should have the above.
Cheers,
Richard
next prev parent reply other threads:[~2016-01-29 6:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 8:45 [PATCH 0/4] base/bbclass: use target path to replace build ones in debugging info Hongxu Jia
2016-01-27 8:45 ` [PATCH 1/4] base/bbclass: use target path as compile dir " Hongxu Jia
2016-01-27 8:45 ` [PATCH 2/4] base/bbclass: disallow appending the compile options " Hongxu Jia
2016-01-27 19:20 ` Khem Raj
2016-01-27 8:45 ` [PATCH 3/4] base/bbclass: use target path as include dir " Hongxu Jia
2016-01-27 8:45 ` [PATCH 4/4] base/bbclass: fix missing to replace build " Hongxu Jia
2016-01-27 10:16 ` [PATCH 0/4] base/bbclass: use target path to replace build ones " Richard Purdie
2016-01-27 19:34 ` Khem Raj
2016-01-27 22:13 ` Richard Purdie
2016-01-28 2:58 ` Hongxu Jia
2016-01-28 17:04 ` Richard Purdie
2016-01-29 3:39 ` Hongxu Jia
2016-01-29 6:40 ` Richard Purdie [this message]
2016-01-29 6:58 ` Hongxu Jia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1454049630.10340.60.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=hongxu.jia@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.