Skip to contentSkip to conversation

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

PATCH In review [email protected] 3 participants 4 messages Oct 23, 2025

lore
Share & tools
lore
#0 lore raw

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

From: Deepesh Varatharajan <[email protected]>

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.

---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
index 5406e542db..d8f9f6c312 100644
@@ -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"
 
 ##################################################################
Signature · 1 line
2.49.0
#1 lore raw

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

Quoted 28 lines · On 23-10-2025 17:04, [email protected] wrote:

From: Deepesh Varatharajan <[email protected]>

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.

---
  meta/conf/bitbake.conf | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -1
index 5406e542db..d8f9f6c312 100644
@@ -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 lore raw
In reply to [email protected]
Quoted 36 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Varatharajan, Deepesh via lists.openembedded.org
Sent: den 23 oktober 2025 13:35
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [OE-core] [PATCH] conf/bitbake.conf: Remove debug flags for native and nativesdk builds

From: Deepesh Varatharajan <[email protected]>

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.

---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +1 -2
index 5406e542db..d8f9f6c312 100644
@@ -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"
 
 ##################################################################
--
Quoted 1 line

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

#3 lore raw

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

Quoted 65 lines · Peter Kjellerstedt via lists.openembedded.org
Quoted 2 lines

-----Original Message-----
From: [email protected] <

[email protected]> On Behalf Of Varatharajan, Deepesh via lists.openembedded.org

Quoted 4 lines

Sent: den 23 oktober 2025 13:35
To: [email protected]
Cc: [email protected]; [email protected]
Subject: [OE-core] [PATCH] conf/bitbake.conf: Remove debug flags for

native and nativesdk builds

Quoted 21 lines

From: Deepesh Varatharajan <[email protected]>

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.

---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/conf/bitbake.conf +0 -0
index 5406e542db..d8f9f6c312 100644

meta/conf/bitbake.conf DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}" · line 663

Quoted 1 line
meta/conf/bitbake.conf +0 -0
@@ -663,7 +663,7 @@ DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}"
 SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD',

'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"

meta/conf/bitbake.conf DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}" · line 664

Quoted 1 line
meta/conf/bitbake.conf +0 -0
 SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION

DEBUG_BUILD"

meta/conf/bitbake.conf DEBUG_OPTIMIZATION = "-Og ${DEBUG_LEVELFLAG}" · line 666

Quoted 2 lines
meta/conf/bitbake.conf +0 -1
 # compiler flags for native/nativesdk
-BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g',

'-O2', d)}"

Quoted 6 lines
meta/conf/bitbake.conf +1 -1
+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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-