diff mbox series

[v2,3/3] bitbake.conf: add debug symbol for sdk

Message ID 20230622161749.797820-3-maxime.roussinbelanger@gmail.com
State New
Headers show
Series [v2,1/3] package: fix src packaging path for nativesdk | expand

Commit Message

Maxime Roussin-Bélanger June 22, 2023, 4:17 p.m. UTC
From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>

Without adding debug flag nativesdk dbg package is not packaged since
there is no debugging information

Signed-off-by: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
---
v2: New commit

 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Kanavin June 22, 2023, 4:30 p.m. UTC | #1
This change is unnecessary, as there is already a mechanism. Just
slightly further down you can see that BUILDSDK_CFLAGS pulls in
BUILD_OPTIMIZATION, which sets -g if you enable DEBUG_BUILD in your
config.

Alex

On Thu, 22 Jun 2023 at 18:20, Maxime Roussin-Bélanger
<maxime.roussinbelanger@gmail.com> wrote:
>
> From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
>
> Without adding debug flag nativesdk dbg package is not packaged since
> there is no debugging information
>
> Signed-off-by: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
> ---
> v2: New commit
>
>  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 9d9b268858..0635affbc1 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -601,7 +601,7 @@ PATCHRESOLVE = "noop"
>  ##################################################################
>
>  export BUILD_CPPFLAGS = "-isystem${STAGING_INCDIR_NATIVE}"
> -BUILDSDK_CPPFLAGS = ""
> +BUILDSDK_CPPFLAGS ?= "-g"
>  export CPPFLAGS = "${TARGET_CPPFLAGS}"
>  TARGET_CPPFLAGS = ""
>
> --
> 2.36.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#183265): https://lists.openembedded.org/g/openembedded-core/message/183265
> Mute This Topic: https://lists.openembedded.org/mt/99701056/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Maxime Roussin-Bélanger June 22, 2023, 5:11 p.m. UTC | #2
Hi Alex,

I don't want a complete debug build. I want to keep optimization and
have the debug symbols. I don't think I can achieve that with
DEBUG_BUILD.

Max

On Thu, Jun 22, 2023 at 12:30 PM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> This change is unnecessary, as there is already a mechanism. Just
> slightly further down you can see that BUILDSDK_CFLAGS pulls in
> BUILD_OPTIMIZATION, which sets -g if you enable DEBUG_BUILD in your
> config.
>
> Alex
>
> On Thu, 22 Jun 2023 at 18:20, Maxime Roussin-Bélanger
> <maxime.roussinbelanger@gmail.com> wrote:
> >
> > From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
> >
> > Without adding debug flag nativesdk dbg package is not packaged since
> > there is no debugging information
> >
> > Signed-off-by: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
> > ---
> > v2: New commit
> >
> >  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 9d9b268858..0635affbc1 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -601,7 +601,7 @@ PATCHRESOLVE = "noop"
> >  ##################################################################
> >
> >  export BUILD_CPPFLAGS = "-isystem${STAGING_INCDIR_NATIVE}"
> > -BUILDSDK_CPPFLAGS = ""
> > +BUILDSDK_CPPFLAGS ?= "-g"
> >  export CPPFLAGS = "${TARGET_CPPFLAGS}"
> >  TARGET_CPPFLAGS = ""
> >
> > --
> > 2.36.0
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#183265): https://lists.openembedded.org/g/openembedded-core/message/183265
> > Mute This Topic: https://lists.openembedded.org/mt/99701056/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
Alexander Kanavin June 23, 2023, 7:50 a.m. UTC | #3
But then you can set the parameters as you want them in your local
configuration. Setting -g globally in the absence of DEBUG_BUILD needs
a use case that applies to most users.

Alex

On Thu, 22 Jun 2023 at 19:11, Maxime Roussin-Bélanger
<maxime.roussinbelanger@gmail.com> wrote:
>
> Hi Alex,
>
> I don't want a complete debug build. I want to keep optimization and
> have the debug symbols. I don't think I can achieve that with
> DEBUG_BUILD.
>
> Max
>
> On Thu, Jun 22, 2023 at 12:30 PM Alexander Kanavin
> <alex.kanavin@gmail.com> wrote:
> >
> > This change is unnecessary, as there is already a mechanism. Just
> > slightly further down you can see that BUILDSDK_CFLAGS pulls in
> > BUILD_OPTIMIZATION, which sets -g if you enable DEBUG_BUILD in your
> > config.
> >
> > Alex
> >
> > On Thu, 22 Jun 2023 at 18:20, Maxime Roussin-Bélanger
> > <maxime.roussinbelanger@gmail.com> wrote:
> > >
> > > From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
> > >
> > > Without adding debug flag nativesdk dbg package is not packaged since
> > > there is no debugging information
> > >
> > > Signed-off-by: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
> > > ---
> > > v2: New commit
> > >
> > >  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 9d9b268858..0635affbc1 100644
> > > --- a/meta/conf/bitbake.conf
> > > +++ b/meta/conf/bitbake.conf
> > > @@ -601,7 +601,7 @@ PATCHRESOLVE = "noop"
> > >  ##################################################################
> > >
> > >  export BUILD_CPPFLAGS = "-isystem${STAGING_INCDIR_NATIVE}"
> > > -BUILDSDK_CPPFLAGS = ""
> > > +BUILDSDK_CPPFLAGS ?= "-g"
> > >  export CPPFLAGS = "${TARGET_CPPFLAGS}"
> > >  TARGET_CPPFLAGS = ""
> > >
> > > --
> > > 2.36.0
> > >
> > >
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > > Links: You receive all messages sent to this group.
> > > View/Reply Online (#183265): https://lists.openembedded.org/g/openembedded-core/message/183265
> > > Mute This Topic: https://lists.openembedded.org/mt/99701056/1686489
> > > Group Owner: openembedded-core+owner@lists.openembedded.org
> > > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > >
Maxime Roussin-Bélanger June 23, 2023, 2:58 p.m. UTC | #4
On Fri, Jun 23, 2023 at 3:50 AM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> But then you can set the parameters as you want them in your local
> configuration. Setting -g globally in the absence of DEBUG_BUILD needs
> a use case that applies to most users.
>
> Alex

If user wants to install nativesdk dgb/src package you need to add that flag,
so instead of modifying the `BUILDSDK_CPPFLAGS`, it should probably be
documented.

Do you have any pointers where it could be documented?

Max.

>
> On Thu, 22 Jun 2023 at 19:11, Maxime Roussin-Bélanger
> <maxime.roussinbelanger@gmail.com> wrote:
> >
> > Hi Alex,
> >
> > I don't want a complete debug build. I want to keep optimization and
> > have the debug symbols. I don't think I can achieve that with
> > DEBUG_BUILD.
> >
> > Max
> >
> > On Thu, Jun 22, 2023 at 12:30 PM Alexander Kanavin
> > <alex.kanavin@gmail.com> wrote:
> > >
> > > This change is unnecessary, as there is already a mechanism. Just
> > > slightly further down you can see that BUILDSDK_CFLAGS pulls in
> > > BUILD_OPTIMIZATION, which sets -g if you enable DEBUG_BUILD in your
> > > config.
> > >
> > > Alex
> > >
> > > On Thu, 22 Jun 2023 at 18:20, Maxime Roussin-Bélanger
> > > <maxime.roussinbelanger@gmail.com> wrote:
> > > >
> > > > From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
> > > >
> > > > Without adding debug flag nativesdk dbg package is not packaged since
> > > > there is no debugging information
> > > >
> > > > Signed-off-by: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
> > > > ---
> > > > v2: New commit
> > > >
> > > >  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 9d9b268858..0635affbc1 100644
> > > > --- a/meta/conf/bitbake.conf
> > > > +++ b/meta/conf/bitbake.conf
> > > > @@ -601,7 +601,7 @@ PATCHRESOLVE = "noop"
> > > >  ##################################################################
> > > >
> > > >  export BUILD_CPPFLAGS = "-isystem${STAGING_INCDIR_NATIVE}"
> > > > -BUILDSDK_CPPFLAGS = ""
> > > > +BUILDSDK_CPPFLAGS ?= "-g"
> > > >  export CPPFLAGS = "${TARGET_CPPFLAGS}"
> > > >  TARGET_CPPFLAGS = ""
> > > >
> > > > --
> > > > 2.36.0
> > > >
> > > >
> > > > -=-=-=-=-=-=-=-=-=-=-=-
> > > > Links: You receive all messages sent to this group.
> > > > View/Reply Online (#183265): https://lists.openembedded.org/g/openembedded-core/message/183265
> > > > Mute This Topic: https://lists.openembedded.org/mt/99701056/1686489
> > > > Group Owner: openembedded-core+owner@lists.openembedded.org
> > > > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> > > > -=-=-=-=-=-=-=-=-=-=-=-
> > > >
Alexander Kanavin June 23, 2023, 3:23 p.m. UTC | #5
On Fri, 23 Jun 2023 at 16:59, Maxime Roussin-Bélanger
<maxime.roussinbelanger@gmail.com> wrote:
> If user wants to install nativesdk dgb/src package you need to add that flag,
> so instead of modifying the `BUILDSDK_CPPFLAGS`, it should probably be
> documented.
>
> Do you have any pointers where it could be documented?

The Yocto SDK manual I suppose?

Alex
Christian Eggers June 23, 2023, 3:42 p.m. UTC | #6
Hi Max,

I use the following lines in my local.conf file (on kirkstone). Maybe that this is not
optimal as it may cause silent side effects in case the original values for 
BUILDSDK_OPTIMIZATION/_CFLAGS/_CXXFALGS will change same day.

# Build -nativesdk packages with debug info (required for generating -dbg/-src packages)
# BUILDSDK_OPTIMIZATION is based on BUILD_OPTIMIZATION in bitbake.conf
BUILDSDK_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og', '-O2', d)} -g -feliminate-unused-debug-types -pipe"
BUILDSDK_CFLAGS = "${BUILDSDK_CPPFLAGS} ${BUILDSDK_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"
BUILDSDK_CXXFLAGS = "${BUILDSDK_CFLAGS}"


Additionally I have to manually select all available nativesdk-*-dbg/-src packages in my
nativesdk-packagegroup-sdk-host.bbappend file. Unfortunately these packages are not added
automatically to my SDK image (SDKIMAGE_FEATURES only applies for target packages, not for
nativesdk packages). Maybe you'll find a better solution for that.

In my project I have added BBCLASSEXTEND="nativesdk" to many bbappends in order to have most
libraries I use on my target also for nativesdk (I can compile my embedded application also
for nativesdk then). As debugging performance using gdbserver is quite poor on my system,
developing my application with nativesdk is a welcome alternative (that's  why I also have
enabled debug information nativesdk).

But from some previous comments on the OE list it seems that nativesdk is not really intended
for this purpose. But what is the alternative? Having two SDKs?

regards
Christian



On Friday, 23 June 2023, 16:58:56 CEST, Maxime Roussin-Bélanger wrote:
> On Fri, Jun 23, 2023 at 3:50 AM Alexander Kanavin
> <alex.kanavin@gmail.com> wrote:
> >
> > But then you can set the parameters as you want them in your local
> > configuration. Setting -g globally in the absence of DEBUG_BUILD needs
> > a use case that applies to most users.
> >
> > Alex
> 
> If user wants to install nativesdk dgb/src package you need to add that flag,
> so instead of modifying the `BUILDSDK_CPPFLAGS`, it should probably be
> documented.
> 
> Do you have any pointers where it could be documented?
> 
> Max.
> 
> >
> > On Thu, 22 Jun 2023 at 19:11, Maxime Roussin-Bélanger
> > <maxime.roussinbelanger@gmail.com> wrote:
> > >
> > > Hi Alex,
> > >
> > > I don't want a complete debug build. I want to keep optimization and
> > > have the debug symbols. I don't think I can achieve that with
> > > DEBUG_BUILD.
> > >
> > > Max
> > >
> > > On Thu, Jun 22, 2023 at 12:30 PM Alexander Kanavin
> > > <alex.kanavin@gmail.com> wrote:
> > > >
> > > > This change is unnecessary, as there is already a mechanism. Just
> > > > slightly further down you can see that BUILDSDK_CFLAGS pulls in
> > > > BUILD_OPTIMIZATION, which sets -g if you enable DEBUG_BUILD in your
> > > > config.
> > > >
> > > > Alex
> > > >
> > > > On Thu, 22 Jun 2023 at 18:20, Maxime Roussin-Bélanger
> > > > <maxime.roussinbelanger@gmail.com> wrote:
> > > > >
> > > > > From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
> > > > >
> > > > > Without adding debug flag nativesdk dbg package is not packaged since
> > > > > there is no debugging information
> > > > >
> > > > > Signed-off-by: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
> > > > > ---
> > > > > v2: New commit
> > > > >
> > > > >  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 9d9b268858..0635affbc1 100644
> > > > > --- a/meta/conf/bitbake.conf
> > > > > +++ b/meta/conf/bitbake.conf
> > > > > @@ -601,7 +601,7 @@ PATCHRESOLVE = "noop"
> > > > >  ##################################################################
> > > > >
> > > > >  export BUILD_CPPFLAGS = "-isystem${STAGING_INCDIR_NATIVE}"
> > > > > -BUILDSDK_CPPFLAGS = ""
> > > > > +BUILDSDK_CPPFLAGS ?= "-g"
> > > > >  export CPPFLAGS = "${TARGET_CPPFLAGS}"
> > > > >  TARGET_CPPFLAGS = ""
> > > > >
> > > > > --
> > > > > 2.36.0
> > > > >
> > > > >
> > > > > 
> > > > >
>
Alexander Kanavin June 23, 2023, 3:53 p.m. UTC | #7
On Fri, 23 Jun 2023 at 17:42, Christian Eggers <ceggers@arri.de> wrote:
> In my project I have added BBCLASSEXTEND="nativesdk" to many bbappends in order to have most
> libraries I use on my target also for nativesdk (I can compile my embedded application also
> for nativesdk then). As debugging performance using gdbserver is quite poor on my system,
> developing my application with nativesdk is a welcome alternative (that's  why I also have
> enabled debug information nativesdk).
>
> But from some previous comments on the OE list it seems that nativesdk is not really intended
> for this purpose. But what is the alternative? Having two SDKs?

The intended way to debug an app is to actually run it in a target
environment or in qemu system emulation. Yes this is more tricky to
set up, but allowing native or nativesdk builds of the target stack
for the sake of debugging is a can of worms I would not want to open.

Alex
diff mbox series

Patch

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 9d9b268858..0635affbc1 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -601,7 +601,7 @@  PATCHRESOLVE = "noop"
 ##################################################################
 
 export BUILD_CPPFLAGS = "-isystem${STAGING_INCDIR_NATIVE}"
-BUILDSDK_CPPFLAGS = ""
+BUILDSDK_CPPFLAGS ?= "-g"
 export CPPFLAGS = "${TARGET_CPPFLAGS}"
 TARGET_CPPFLAGS = ""