* [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo @ 2016-05-21 20:08 Charles Hardin 2016-06-11 14:19 ` Thomas Petazzoni 2016-07-01 21:36 ` Thomas Petazzoni 0 siblings, 2 replies; 7+ messages in thread From: Charles Hardin @ 2016-05-21 20:08 UTC (permalink / raw) To: buildroot From the documentation on BR2_ENABLE_DEBUG, the intention is to get a build with debug symbols and not a "debug build" since that can have the unintended consequence of being a different code path then a release build type definition. Switch the "Debug" to "RelWithDebInfo" in the cmake package support to accomodate getting the debug symbols and still be a release build. Signed-off-by: Charles Hardin <ckhardin@exablox.com> --- package/pkg-cmake.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk index 81dcfcc..bca3603 100644 --- a/package/pkg-cmake.mk +++ b/package/pkg-cmake.mk @@ -87,7 +87,7 @@ define $(2)_CONFIGURE_CMDS PATH=$$(BR_PATH) \ $$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \ -DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \ - -DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,Release) \ + -DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),RelWithDebInfo,Release) \ -DCMAKE_INSTALL_PREFIX="/usr" \ -DCMAKE_COLOR_MAKEFILE=OFF \ -DBUILD_DOC=OFF \ -- 2.7.4 (Apple Git-66) ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo 2016-05-21 20:08 [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo Charles Hardin @ 2016-06-11 14:19 ` Thomas Petazzoni 2016-06-11 15:22 ` Samuel Martin 2016-07-01 21:36 ` Thomas Petazzoni 1 sibling, 1 reply; 7+ messages in thread From: Thomas Petazzoni @ 2016-06-11 14:19 UTC (permalink / raw) To: buildroot Samuel, Please review/ack this patch if appropriate. If there is no feedback in the next days, I'll assume it's good and I'll apply. Thanks, Thomas On Sat, 21 May 2016 13:08:34 -0700, Charles Hardin wrote: > From the documentation on BR2_ENABLE_DEBUG, the intention is to get > a build with debug symbols and not a "debug build" since that can have > the unintended consequence of being a different code path then a > release build type definition. > > Switch the "Debug" to "RelWithDebInfo" in the cmake package support > to accomodate getting the debug symbols and still be a release > build. > > Signed-off-by: Charles Hardin <ckhardin@exablox.com> > --- > package/pkg-cmake.mk | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk > index 81dcfcc..bca3603 100644 > --- a/package/pkg-cmake.mk > +++ b/package/pkg-cmake.mk > @@ -87,7 +87,7 @@ define $(2)_CONFIGURE_CMDS > PATH=$$(BR_PATH) \ > $$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \ > -DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \ > - -DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,Release) \ > + -DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),RelWithDebInfo,Release) \ > -DCMAKE_INSTALL_PREFIX="/usr" \ > -DCMAKE_COLOR_MAKEFILE=OFF \ > -DBUILD_DOC=OFF \ -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo 2016-06-11 14:19 ` Thomas Petazzoni @ 2016-06-11 15:22 ` Samuel Martin 2016-06-11 17:06 ` Thomas Petazzoni 0 siblings, 1 reply; 7+ messages in thread From: Samuel Martin @ 2016-06-11 15:22 UTC (permalink / raw) To: buildroot Hi all, On Sat, Jun 11, 2016 at 4:19 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Samuel, > > Please review/ack this patch if appropriate. > > If there is no feedback in the next days, I'll assume it's good and > I'll apply. Ooops, I missed this patch :-/ > > Thanks, > > Thomas > > On Sat, 21 May 2016 13:08:34 -0700, Charles Hardin wrote: >> From the documentation on BR2_ENABLE_DEBUG, the intention is to get >> a build with debug symbols and not a "debug build" since that can have >> the unintended consequence of being a different code path then a >> release build type definition. >> >> Switch the "Debug" to "RelWithDebInfo" in the cmake package support >> to accomodate getting the debug symbols and still be a release >> build. >> By default CMake sets the CFLAGS like this: CMAKE_C_FLAGS_DEBUG=-g CMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG CMAKE_C_FLAGS_RELEASE=-O3 -DNDEBUG I do not see what could be wrong with this patch, hence: Reviewed-by: Samuel Martin <s.martin49@gmail.com> >> Signed-off-by: Charles Hardin <ckhardin@exablox.com> >> --- >> package/pkg-cmake.mk | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk >> index 81dcfcc..bca3603 100644 >> --- a/package/pkg-cmake.mk >> +++ b/package/pkg-cmake.mk >> @@ -87,7 +87,7 @@ define $(2)_CONFIGURE_CMDS >> PATH=$$(BR_PATH) \ >> $$($$(PKG)_CONF_ENV) $$(HOST_DIR)/usr/bin/cmake $$($$(PKG)_SRCDIR) \ >> -DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/usr/share/buildroot/toolchainfile.cmake" \ >> - -DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),Debug,Release) \ >> + -DCMAKE_BUILD_TYPE=$$(if $$(BR2_ENABLE_DEBUG),RelWithDebInfo,Release) \ >> -DCMAKE_INSTALL_PREFIX="/usr" \ >> -DCMAKE_COLOR_MAKEFILE=OFF \ >> -DBUILD_DOC=OFF \ > > > > -- > Thomas Petazzoni, CTO, Free Electrons > Embedded Linux, Kernel and Android engineering > http://free-electrons.com Regards, -- Samuel ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo 2016-06-11 15:22 ` Samuel Martin @ 2016-06-11 17:06 ` Thomas Petazzoni 2016-06-11 17:22 ` Samuel Martin 0 siblings, 1 reply; 7+ messages in thread From: Thomas Petazzoni @ 2016-06-11 17:06 UTC (permalink / raw) To: buildroot Hello, On Sat, 11 Jun 2016 17:22:24 +0200, Samuel Martin wrote: > By default CMake sets the CFLAGS like this: > CMAKE_C_FLAGS_DEBUG=-g > CMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG Is -O2 -g really what we want for debugging? Optimized code very often doesn't play well with debugging. Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo 2016-06-11 17:06 ` Thomas Petazzoni @ 2016-06-11 17:22 ` Samuel Martin 2016-06-11 17:32 ` Charles Hardin 0 siblings, 1 reply; 7+ messages in thread From: Samuel Martin @ 2016-06-11 17:22 UTC (permalink / raw) To: buildroot On Sat, Jun 11, 2016 at 7:06 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Hello, > > On Sat, 11 Jun 2016 17:22:24 +0200, Samuel Martin wrote: > >> By default CMake sets the CFLAGS like this: >> CMAKE_C_FLAGS_DEBUG=-g >> CMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG > > Is -O2 -g really what we want for debugging? Optimized code very often > doesn't play well with debugging. To be honest, I don't have a strong opinion about it. Note that this is the default flags CMake sets; if you add to the configure opts: -DCMAKE_C_FLAGS_RELWITHDEBINFO=-g -O1 -UNDEBUG then these flags are taken into account, not the default ones. OTOH, applying no optimization at all in debug build may lead to some size issues for (very) tiny targets... Who knows? though I don't remember any bug report/complaint about such a situation. Regards, -- Samuel ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo 2016-06-11 17:22 ` Samuel Martin @ 2016-06-11 17:32 ` Charles Hardin 0 siblings, 0 replies; 7+ messages in thread From: Charles Hardin @ 2016-06-11 17:32 UTC (permalink / raw) To: buildroot We hit the size and the NDEBUG issue as well. Sent from my iPhone > On Jun 11, 2016, at 10:22 AM, Samuel Martin <s.martin49@gmail.com> wrote: > > On Sat, Jun 11, 2016 at 7:06 PM, Thomas Petazzoni > <thomas.petazzoni@free-electrons.com> wrote: >> Hello, >> >>> On Sat, 11 Jun 2016 17:22:24 +0200, Samuel Martin wrote: >>> >>> By default CMake sets the CFLAGS like this: >>> CMAKE_C_FLAGS_DEBUG=-g >>> CMAKE_C_FLAGS_RELWITHDEBINFO=-O2 -g -DNDEBUG >> >> Is -O2 -g really what we want for debugging? Optimized code very often >> doesn't play well with debugging. > > To be honest, I don't have a strong opinion about it. > > Note that this is the default flags CMake sets; if you add to the > configure opts: > -DCMAKE_C_FLAGS_RELWITHDEBINFO=-g -O1 -UNDEBUG > then these flags are taken into account, not the default ones. > > OTOH, applying no optimization at all in debug build may lead to some > size issues for (very) tiny targets... Who knows? though I don't > remember any bug report/complaint about such a situation. > > Regards, > > -- > Samuel ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo 2016-05-21 20:08 [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo Charles Hardin 2016-06-11 14:19 ` Thomas Petazzoni @ 2016-07-01 21:36 ` Thomas Petazzoni 1 sibling, 0 replies; 7+ messages in thread From: Thomas Petazzoni @ 2016-07-01 21:36 UTC (permalink / raw) To: buildroot Hello, On Sat, 21 May 2016 13:08:34 -0700, Charles Hardin wrote: > From the documentation on BR2_ENABLE_DEBUG, the intention is to get > a build with debug symbols and not a "debug build" since that can have > the unintended consequence of being a different code path then a > release build type definition. > > Switch the "Debug" to "RelWithDebInfo" in the cmake package support > to accomodate getting the debug symbols and still be a release > build. > > Signed-off-by: Charles Hardin <ckhardin@exablox.com> > --- > package/pkg-cmake.mk | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied to master, thanks. Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-07-01 21:36 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-05-21 20:08 [Buildroot] [PATCH 1/1] package/cmake: with BR2_ENABLE_DEBUG use RelWithDebInfo Charles Hardin 2016-06-11 14:19 ` Thomas Petazzoni 2016-06-11 15:22 ` Samuel Martin 2016-06-11 17:06 ` Thomas Petazzoni 2016-06-11 17:22 ` Samuel Martin 2016-06-11 17:32 ` Charles Hardin 2016-07-01 21:36 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox