Search code examples
gccyoctobitbake

DEBUG_FLAGS in Yocto is always used


I tried to build my program via Yocto and faced to problem of large size of executable. After some investigation I found out that my program was built with GCC flag -g (produce debugging info). It's turned out this flag is setted in file bitbake.conf:

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(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"

So flag -g is used in every build, no difference DEBUG_BUILD variable is defined or not. The only workaround that I found is to set ${DEBUG_FLAGS} = " " in my program recipe.

So, my question is: is there any better solutions? And is it normal, that all packages in Yocto are built with debug flag? It seems to be overrun solution, especially for embedded devices.


Solution

  • See @Parthiban comments. There is no problem in essence.