diff mbox series

conf/bitbake.conf: Remove debug flags for native and nativesdk builds

Message ID 20251023113444.882980-1-Deepesh.Varatharajan@windriver.com
State New
Headers show
Series conf/bitbake.conf: Remove debug flags for native and nativesdk builds | expand

Commit Message

Deepesh Varatharajan Oct. 23, 2025, 11:34 a.m. UTC
From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>

The native and nativesdk builds were previously using the '-Og -g' flags
during debug builds. This resulted in increased disk usage and few linker
memory issues due to the large debug information generated.

Since native and nativesdk components do not require debug symbols,
update the build flags to use '-O2' instead of '-Og -g' for these builds.
This reduces build size and avoids memory-related issues during linking.

Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Deepesh Varatharajan Oct. 23, 2025, 11:53 a.m. UTC | #1
Hi All,

Testing results :

qemux86-64

time taken for bitbake clang & bitbake gcc for debug builds

with (-g -Og)                        with(-O2)            Diff
  real    46m43.329s             real    41m28.778s             -5m 14.551s
  user    0m22.136s              user    0m22.134s -0.002s
  sys     0m3.048s                  sys     0m3.020s  -0.028s

tmp Dir
size 86 GB                            size 38 GB           -48 GB


qemuarm64

time taken for bitbake clang & bitbake gcc  for debug builds

  with (-g -Og)                       with(-O2)          Diff
  real    48m26.788s            real    41m46.814s            -6m 39.974s
  user    0m30.930s             user    0m21.854s  -9.076s
  sys     0m4.068s                 sys     0m3.085s -0.983s

tmp Dir
size 92 GB                            size 41 GB        -51 GB

Regards,
Deepesh

On 23-10-2025 17:04, Deepesh.Varatharajan@windriver.com wrote:
> From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
>
> The native and nativesdk builds were previously using the '-Og -g' flags
> during debug builds. This resulted in increased disk usage and few linker
> memory issues due to the large debug information generated.
>
> Since native and nativesdk components do not require debug symbols,
> update the build flags to use '-O2' instead of '-Og -g' for these builds.
> This reduces build size and avoids memory-related issues during linking.
>
> Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@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 5406e542db..d8f9f6c312 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -663,7 +663,7 @@ DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}"
>   SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
>   SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
>   # compiler flags for native/nativesdk
> -BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}"
> +BUILD_OPTIMIZATION = '-O2'
>   BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD"
>   
>   ##################################################################
Peter Kjellerstedt Oct. 23, 2025, noon UTC | #2
> -----Original Message-----
> From: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> On Behalf Of Varatharajan, Deepesh via lists.openembedded.org
> Sent: den 23 oktober 2025 13:35
> To: openembedded-core@lists.openembedded.org
> Cc: Sundeep.Kokkonda@windriver.com; Deepesh.Varatharajan@windriver.com
> Subject: [OE-core] [PATCH] conf/bitbake.conf: Remove debug flags for native and nativesdk builds
> 
> From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
> 
> The native and nativesdk builds were previously using the '-Og -g' flags
> during debug builds. This resulted in increased disk usage and few linker
> memory issues due to the large debug information generated.
> 
> Since native and nativesdk components do not require debug symbols,
> update the build flags to use '-O2' instead of '-Og -g' for these builds.
> This reduces build size and avoids memory-related issues during linking.
> 
> Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@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 5406e542db..d8f9f6c312 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -663,7 +663,7 @@ DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}"
>  SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
>  SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
>  # compiler flags for native/nativesdk
> -BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}"
> +BUILD_OPTIMIZATION = '-O2'
>  BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD"
> 
>  ##################################################################
> --
> 2.49.0

I am sorry, but I must be missing something. If I enable DEBUG_BUILD for 
a native recipe, I definitely expect it to be compiled with -Og so I can 
debug it in gdb.

If what you really want to do is enable debug for all target recipes, 
then use DEBUG_BUILD:class-target = "1" in your local.conf instead.

//Peter
Alexander Kanavin Oct. 23, 2025, 12:41 p.m. UTC | #3
Yes, absolutely. You’d be surprised how often something native crashes or
exhibits unusual behaviour and then debugging it in gdb is absolutely
essential.

Alex

On Thu 23. Oct 2025 at 14.00, Peter Kjellerstedt via lists.openembedded.org
<peter.kjellerstedt=axis.com@lists.openembedded.org> wrote:

> > -----Original Message-----
> > From: openembedded-core@lists.openembedded.org <
> openembedded-core@lists.openembedded.org> On Behalf Of Varatharajan,
> Deepesh via lists.openembedded.org
> > Sent: den 23 oktober 2025 13:35
> > To: openembedded-core@lists.openembedded.org
> > Cc: Sundeep.Kokkonda@windriver.com; Deepesh.Varatharajan@windriver.com
> > Subject: [OE-core] [PATCH] conf/bitbake.conf: Remove debug flags for
> native and nativesdk builds
> >
> > From: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
> >
> > The native and nativesdk builds were previously using the '-Og -g' flags
> > during debug builds. This resulted in increased disk usage and few linker
> > memory issues due to the large debug information generated.
> >
> > Since native and nativesdk components do not require debug symbols,
> > update the build flags to use '-O2' instead of '-Og -g' for these builds.
> > This reduces build size and avoids memory-related issues during linking.
> >
> > Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@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 5406e542db..d8f9f6c312 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -663,7 +663,7 @@ DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}"
> >  SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',
> 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
> >  SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION
> DEBUG_BUILD"
> >  # compiler flags for native/nativesdk
> > -BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g',
> '-O2', d)}"
> > +BUILD_OPTIMIZATION = '-O2'
> >  BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD"
> >
> >  ##################################################################
> > --
> > 2.49.0
>
> I am sorry, but I must be missing something. If I enable DEBUG_BUILD for
> a native recipe, I definitely expect it to be compiled with -Og so I can
> debug it in gdb.
>
> If what you really want to do is enable debug for all target recipes,
> then use DEBUG_BUILD:class-target = "1" in your local.conf instead.
>
> //Peter
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#225247):
> https://lists.openembedded.org/g/openembedded-core/message/225247
> Mute This Topic: https://lists.openembedded.org/mt/115908796/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 5406e542db..d8f9f6c312 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -663,7 +663,7 @@  DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}"
 SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
 SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
 # compiler flags for native/nativesdk
-BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g', '-O2', d)}"
+BUILD_OPTIMIZATION = '-O2'
 BUILD_OPTIMIZATION[vardeps] += "DEBUG_BUILD"
 
 ##################################################################