Introduce BR2_ENABLE_RUNTIME_DEBUG
v3 cover Introduce BR2_ENABLE_RUNTIME_DEBUG
From: Thomas De Schampheleire <[email protected]>
Hello,
This patch series started with as main goal to fix the performance degradation found when testing gRPC in combination with BR2_ENABLE_DEBUG.
Its implementation strives to settle a discussion that has happened several times, regarding the CMAKE_BUILD_TYPE that Buildroot should set, by not forcing anything upon the user but allowing the choice.
Additionally, it cleans up some related changes done in specific packages.
After this series, there are still packages that set CMAKE_BUILD_TYPE explicitly, but the associated comments indicate that they are needed to avoid build failures, so they are not touched.
v2: fix sysrepo after comment by Jan Kundr?t (thanks!)
v3:
- new patch setting -g0 (Arnout)
- don't set -DNDEBUG globally anymore, and drop related libjson change
- flare-engine, supertux: retain disabling of -pg option (Arnout)
- sysrepo: new patch for host-sysrepo, disable tests for target (Arnout)
- update several packages to use BR2_ENABLE_RUNTIME_DEBUG instead of BR2_ENABLE_DEBUG
Thomas De Schampheleire (15):
package/Makefile.in: pass '-g0' explicitly if !BR2_ENABLE_DEBUG
core: introduce BR2_ENABLE_RUNTIME_DEBUG package/pkg-cmake.mk: determine CMAKE_BUILD_TYPE depending on
BR2_ENABLE_RUNTIME_DEBUG
package/flare-engine: update explicit setting of CMAKE_BUILD_TYPE package/sysrepo: use default CMAKE_BUILD_TYPE for host package package/sysrepo: remove explicit setting of CMAKE_BUILD_TYPE package/boost: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG package/oracle-mysql: use BR2_ENABLE_RUNTIME_DEBUG iso
BR2_ENABLE_DEBUG
package/qt5: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG package/ripgrep: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG package/sofia-sip: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG package/uclibc: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG package/zmqpp: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG package/pkg-meson.mk: determine 'buildtype' based on
BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
utils/genrandconfig: also test BR2_ENABLE_RUNTIME_DEBUG
Config.in | 13 +++++++++++++ docs/manual/adding-packages-cmake.txt | 2 +- package/Makefile.in | 3 +++ package/boost/boost.mk | 2 +- package/flare-engine/flare-engine.mk | 2 +- package/oracle-mysql/oracle-mysql.mk | 2 +- package/pkg-cmake.mk | 2 +- package/pkg-meson.mk | 2 +- package/qt5/qt5base/qt5base.mk | 2 +- package/ripgrep/ripgrep.mk | 2 +- package/sofia-sip/sofia-sip.mk | 2 +- package/sysrepo/sysrepo.mk | 9 ++++++--- package/uclibc/uclibc.mk | 2 +- package/zmqpp/zmqpp.mk | 2 +- utils/genrandconfig | 2 ++ 15 files changed, 35 insertions(+), 14 deletions(-)
Signature · 1 line
2.26.3
PATCH v3 1/15 package/Makefile.in: pass '-g0' explicitly if !BR2_ENABLE_DEBUG
From: Thomas De Schampheleire <[email protected]>
If BR2_ENABLE_DEBUG is not set, Buildroot did not pass any flag to control debug level. This means that the build system of the package itself would control it.
Instead, provide an explicit '-g0' (no debugging symbols) to get consistent behavior across packages.
--- package/Makefile.in | 3 +++ 1 file changed, 3 insertions(+)
package/Makefile.in +3 -0
@@ -136,6 +136,9 @@ endif ifeq ($(BR2_OPTIMIZE_FAST),y) TARGET_OPTIMIZATION = -Ofast endif +ifeq ($(BR2_ENABLE_DEBUG),) +TARGET_DEBUGGING = -g0 +endif ifeq ($(BR2_DEBUG_1),y) TARGET_DEBUGGING = -g1 endif
Signature · 1 line
2.26.3
Arnout Vandecappelle
AppliedPATCH v3 1/15 package/Makefile.in: pass '-g0' explicitly if !BR2_ENABLE_DEBUG
Quoted 11 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
If
BR2_ENABLE_DEBUGis not set, Buildroot did not pass any flag to control debug level. This means that the build system of the package itself would control it.Instead, provide an explicit '-g0' (no debugging symbols) to get consistent behavior across packages.
Suggested-by Arnout Vandecappelle <[email protected]>Signed-off-by Thomas De Schampheleire <[email protected]>
Applied to next, thanks.
Regards,
Arnout
Quoted 19 lines
--- package/Makefile.in | 3 +++ 1 file changed, 3 insertions(+)package/Makefile.in +3
-0@@ -136,6 +136,9 @@ endif ifeq ($(BR2_OPTIMIZE_FAST),y) TARGET_OPTIMIZATION = -Ofast endif +ifeq ($(BR2_ENABLE_DEBUG),) +TARGET_DEBUGGING = -g0 +endif ifeq ($(BR2_DEBUG_1),y) TARGET_DEBUGGING = -g1 endif
PATCH v3 2/15 core: introduce BR2_ENABLE_RUNTIME_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
Some packages have optional runtime assertions, extra traces, or other elements that can help in debugging problems. However, such runtime elements can negatively influence performance.
In a test program performing 100K gRPC calls from a client to a local server and receiving the returned response, we see following execution time:
- runtime debug enabled: 1065 seconds
- runtime debug disabled: 48 seconds
This is more than a factor 20 (!) difference. Analysis shows that the problem mostly stems from libabseil-cpp (a dependency of gRPC) which enables mutex deadlock analysis when the preprocessor flag 'NDEBUG' is not set, which adds a 'backtrace()' call on every lock/unlock. Potentially worse, when libunwind is enabled and linked with the test program, 'backtrace()' is not provided by glibc but by libunwind itself.
For production systems, users expect good performance out-of-the-box. In the example above, the difference is huge and unless explicitly tested and analyzed, users may not realize that the performance could be much better.
Address this problem by introducing a new option BR2_ENABLE_RUNTIME_DEBUG, which can be used by packages or package infrastructures to set the necessary flags.
Note that BR2_ENABLE_RUNTIME_DEBUG is orthogonal to BR2_ENABLE_DEBUG: the former changes runtime behavior, while the latter is only expected to add debug symbols to the build. Today, the cmake build system does introduce a runtime impact when BR2_ENABLE_DEBUG is set, but that will be rectified in a subsequent commit.
--- Config.in | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Config.in +13 -0
@@ -412,6 +412,19 @@ config BR2_DEBUG_3 endchoice endif +config BR2_ENABLE_RUNTIME_DEBUG + bool "build packages with runtime debugging info" + help + Some packages may have runtime assertions, extra traces, and + similar runtime elements that can help debugging. However, + these elements may negatively influence performance so should + normally not be enabled on production systems. + + Enable this option to enable such runtime debugging. + + Note: disabling this option is not a guarantee that all + packages effectively removed these runtime debugging elements. + config BR2_STRIP_strip bool "strip target binaries" default y
Signature · 1 line
2.26.3
PATCH v3 2/15 core: introduce BR2_ENABLE_RUNTIME_DEBUG
Quoted 43 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
Some packages have optional runtime assertions, extra traces, or other elements that can help in debugging problems. However, such runtime elements can negatively influence performance.
In a test program performing 100K gRPC calls from a client to a local server and receiving the returned response, we see following execution time:
- runtime debug enabled: 1065 seconds
- runtime debug disabled: 48 secondsThis is more than a factor 20 (!) difference. Analysis shows that the problem mostly stems from libabseil-cpp (a dependency of gRPC) which enables mutex deadlock analysis when the preprocessor flag 'NDEBUG' is not set, which adds a '
backtrace()' call on every lock/unlock. Potentially worse, when libunwind is enabled and linked with the test program, 'backtrace()' is not provided by glibc but by libunwind itself.For production systems, users expect good performance out-of-the-box. In the example above, the difference is huge and unless explicitly tested and analyzed, users may not realize that the performance could be much better.
Address this problem by introducing a new option
BR2_ENABLE_RUNTIME_DEBUG, which can be used by packages or package infrastructures to set the necessary flags.Note that
BR2_ENABLE_RUNTIME_DEBUGis orthogonal toBR2_ENABLE_DEBUG: the former changes runtime behavior, while the latter is only expected to add debug symbols to the build. Today, the cmake build system does introduce a runtime impact whenBR2_ENABLE_DEBUGis set, but that will be rectified in a subsequent commit.Signed-off-by Thomas De Schampheleire <[email protected]>--- Config.in | 13 +++++++++++++ 1 file changed, 13 insertions(+)Config.in +0
-0
Config.in config BR2_DEBUG_3 · line 415
Quoted 4 lines
Config.in +1
-0@@ -412,6 +412,19 @@ config BR2_DEBUG_3 endchoice endif +config BR2_ENABLE_RUNTIME_DEBUG
I'm still not convinced that RUNTIME_DEBUG is the best name, but I can't think
of anything better.
Config.in config BR2_DEBUG_3 · line 416
Quoted 1 line
Config.in +1
-0+ bool "build packages with runtime debugging info"
It's not debugging info (that is actually covered by BR2_ENABLE_DEBUG) - it's
debugging support. Or maybe just "debugging".
Nitpick, of course, so:
Regards,
Arnout
Quoted 15 lines
Config.in +11
-0+ help + Some packages may have runtime assertions, extra traces, and + similar runtime elements that can help debugging. However, + these elements may negatively influence performance so should + normally not be enabled on production systems. + + Enable this option to enable such runtime debugging. + + Note: disabling this option is not a guarantee that all + packages effectively removed these runtime debugging elements. + config BR2_STRIP_strip bool "strip target binaries" default y
PATCH v3 2/15 core: introduce BR2_ENABLE_RUNTIME_DEBUG
El mar, 25 may 2021 a las 22:34, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 55 lines · Thomas De Schampheleire
Quoted 43 lines
From: Thomas De Schampheleire <[email protected]>
Some packages have optional runtime assertions, extra traces, or other elements that can help in debugging problems. However, such runtime elements can negatively influence performance.
In a test program performing 100K gRPC calls from a client to a local server and receiving the returned response, we see following execution time:
- runtime debug enabled: 1065 seconds
- runtime debug disabled: 48 secondsThis is more than a factor 20 (!) difference. Analysis shows that the problem mostly stems from libabseil-cpp (a dependency of gRPC) which enables mutex deadlock analysis when the preprocessor flag 'NDEBUG' is not set, which adds a '
backtrace()' call on every lock/unlock. Potentially worse, when libunwind is enabled and linked with the test program, 'backtrace()' is not provided by glibc but by libunwind itself.For production systems, users expect good performance out-of-the-box. In the example above, the difference is huge and unless explicitly tested and analyzed, users may not realize that the performance could be much better.
Address this problem by introducing a new option
BR2_ENABLE_RUNTIME_DEBUG, which can be used by packages or package infrastructures to set the necessary flags.Note that
BR2_ENABLE_RUNTIME_DEBUGis orthogonal toBR2_ENABLE_DEBUG: the former changes runtime behavior, while the latter is only expected to add debug symbols to the build. Today, the cmake build system does introduce a runtime impact whenBR2_ENABLE_DEBUGis set, but that will be rectified in a subsequent commit.Signed-off-by Thomas De Schampheleire <[email protected]>--- Config.in | 13 +++++++++++++ 1 file changed, 13 insertions(+)Config.in +0
-0Config.in config BR2_DEBUG_3 · line 415
Quoted 4 lines
Config.in +1
-0@@ -412,6 +412,19 @@ config BR2_DEBUG_3 endchoice endif +config BR2_ENABLE_RUNTIME_DEBUGI'm still not convinced that
RUNTIME_DEBUGis the best name, but I can't think
of anything better.
Quoted 4 lines
Config.in config BR2_DEBUG_3 · line 416
Quoted 1 line
Config.in +1
-0+ bool "build packages with runtime debugging info"It's not debugging info (that is actually covered by
BR2_ENABLE_DEBUG) - it's
debugging support. Or maybe just "debugging".
It's hard to describe it well because the exact influence will depend on the package.
For some it will only be asserts that enabled/disabled, others will have extra traces, yet others will compile additional code for developers.
I feel that "build packages with runtime debugging support" may give the false impression that this option is needed in order to be able to debug the package.
But likewise, the original title of this option could also be interpreted incorrectly.
So I suggest that the person that applies the patch can make the final call ;-)
Thanks,
Thomas
PATCH v3 3/15 package/pkg-cmake.mk: determine CMAKE_BUILD_TYPE depending on BR2_ENABLE_RUNTIME_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
The CMAKE_BUILD_TYPE is currently set as 'Debug' in case BR2_ENABLE_DEBUG is set, and as 'Release' in other cases. However, while the description of BR2_ENABLE_DEBUG is to enable debug symbols (no runtime impact), the 'Debug' build type in CMake can actually have runtime impact. For one, because it does not set -DNDEBUG like is done for 'Release', but also because packages may do custom things based on it.
The question of which CMAKE_BUILD_TYPE Buildroot should set, be it 'Debug', 'Release', 'RelWithDebInfo' or others, has come up several times in the past. See some references below:
- July 2016: switch from Debug to RelWithDebInfo:
https://git.buildroot.org/buildroot/commit/?id=4b0120183404913f7f7788ef4f0f6b51498ef363
- October 2016: switch from RelWithDebInfo back to Debug:
https://git.buildroot.org/buildroot/commit/?id=104bb29e0490bfb487e2e665448dd3ca07fcc2b5
and changes to make sure Buildroot's flags are respected:
https://git.buildroot.org/buildroot/commit/?id=12494ef48f893684d0800e7f6fe39a2ceaed0451
- August 2017: bug #10246 - "BR2_ENABLE_DEBUG does not have the expected effect for cmake packages"
https://bugs.busybox.net/show_bug.cgi?id=10246
- August 2017: mail thread following bug #10246:
http://lists.busybox.net/pipermail/buildroot/2017-August/200778.html
In the last mail thread, Samuel Martin confirmed that the 'Release' build type could be used in all cases, because Buildroot is actually making sure that the optimization flags are those determined by Buildroot, not the defaults of cmake, thanks to commit 12494ef48f.
But Arnout Vandecappelle objected to using always 'Release', stating that users may actually want the extra assertions.
With the introduction of BR2_ENABLE_RUNTIME_DEBUG, Buildroot can now cater for all cases:
- use CMAKE_BUILD_TYPE=Release by default. This makes sure that there is no unexpected performance degradation triggered by enabling BR2_ENABLE_DEBUG.
- users can optionally enable BR2_ENABLE_RUNTIME_DEBUG if they want runtime debug info like assertions, at the risk of introducing performance degradation. In this case, we switch to CMAKE_BUILD_TYPE=Debug.
- orthogonally to the above, BR2_ENABLE_DEBUG still determines passing the '-g' flag to enable debug symbols, and BR2_OPTIMIZE_X still determines the used optimization flags.
--- docs/manual/adding-packages-cmake.txt | 2 +- package/pkg-cmake.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
docs/manual/adding-packages-cmake.txt +1 -1
@@ -100,7 +100,7 @@ typical packages will therefore only use a few of them. necessary to set them in the package's +*.mk+ file unless you want to override them: -** +CMAKE_BUILD_TYPE+ is driven by +BR2_ENABLE_DEBUG+; +** +CMAKE_BUILD_TYPE+ is driven by +BR2_ENABLE_RUNTIME_DEBUG+; ** +CMAKE_INSTALL_PREFIX+; ** +BUILD_SHARED_LIBS+ is driven by +BR2_STATIC_LIBS+; ** +BUILD_DOC+, +BUILD_DOCS+ are disabled;
package/pkg-cmake.mk +1 -1
@@ -266,7 +266,7 @@ define TOOLCHAIN_CMAKE_INSTALL_FILES -e 's#@@CMAKE_SYSTEM_PROCESSOR@@#$(call qstrip,$(CMAKE_SYSTEM_PROCESSOR))#' \ -e 's#@@TOOLCHAIN_HAS_CXX@@#$(if $(BR2_INSTALL_LIBSTDCPP),1,0)#' \ -e 's#@@TOOLCHAIN_HAS_FORTRAN@@#$(if $(BR2_TOOLCHAIN_HAS_FORTRAN),1,0)#' \ - -e 's#@@CMAKE_BUILD_TYPE@@#$(if $(BR2_ENABLE_DEBUG),Debug,Release)#' \ + -e 's#@@CMAKE_BUILD_TYPE@@#$(if $(BR2_ENABLE_RUNTIME_DEBUG),Debug,Release)#' \ $(TOPDIR)/support/misc/toolchainfile.cmake.in \ > $(HOST_DIR)/share/buildroot/toolchainfile.cmake $(Q)$(INSTALL) -D -m 0644 support/misc/Buildroot.cmake \
Signature · 1 line
2.26.3
PATCH v3 3/15 package/pkg-cmake.mk: determine CMAKE_BUILD_TYPE depending on BR2_ENABLE_RUNTIME_DEBUG
Quoted 45 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
The
CMAKE_BUILD_TYPEis currently set as 'Debug' in caseBR2_ENABLE_DEBUGis set, and as 'Release' in other cases. However, while the description ofBR2_ENABLE_DEBUGis to enable debug symbols (no runtime impact), the 'Debug' build type in CMake can actually have runtime impact. For one, because it does not set -DNDEBUG like is done for 'Release', but also because packages may do custom things based on it.The question of which
CMAKE_BUILD_TYPEBuildroot should set, be it 'Debug', 'Release', 'RelWithDebInfo' or others, has come up several times in the past. See some references below:- July 2016: switch from Debug to RelWithDebInfo:
https://git.buildroot.org/buildroot/commit/?id=4b0120183404913f7f7788ef4f0f6b51498ef363- October 2016: switch from RelWithDebInfo back to Debug:
https://git.buildroot.org/buildroot/commit/?id=104bb29e0490bfb487e2e665448dd3ca07fcc2b5
and changes to make sure Buildroot's flags are respected:
https://git.buildroot.org/buildroot/commit/?id=12494ef48f893684d0800e7f6fe39a2ceaed0451- August 2017: bug #10246 - "
BR2_ENABLE_DEBUGdoes not have the expected effect for cmake packages"
https://bugs.busybox.net/show_bug.cgi?id=10246- August 2017: mail thread following bug #10246:
http://lists.busybox.net/pipermail/buildroot/2017-August/200778.htmlIn the last mail thread, Samuel Martin confirmed that the 'Release' build type could be used in all cases, because Buildroot is actually making sure that the optimization flags are those determined by Buildroot, not the defaults of cmake, thanks to commit
12494ef48f.
But Arnout Vandecappelle objected to using always 'Release', stating that users may actually want the extra assertions.With the introduction of
BR2_ENABLE_RUNTIME_DEBUG, Buildroot can now cater for all cases:- use CMAKE_BUILD_TYPE=Release by default. This makes sure that there is no unexpected performance degradation triggered by enabling
BR2_ENABLE_DEBUG.- users can optionally enable
BR2_ENABLE_RUNTIME_DEBUGif they want runtime debug info like assertions, at the risk of introducing performance degradation. In this case, we switch to CMAKE_BUILD_TYPE=Debug.
Quoted 5 lines
- orthogonally to the above,
BR2_ENABLE_DEBUGstill determines passing the '-g' flag to enable debug symbols, andBR2_OPTIMIZE_Xstill determines the used optimization flags.Signed-off-by Thomas De Schampheleire <[email protected]>
Regards,
Arnout
Quoted 31 lines
--->
docs/manual/adding-packages-cmake.txt| 2 +-package/pkg-cmake.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)docs/manual/adding-packages-cmake.txt +1
-1@@ -100,7 +100,7 @@ typical packages will therefore only use a few of them. necessary to set them in the package's +*.mk+ file unless you want to override them: -** +CMAKE_BUILD_TYPE+ is driven by +BR2_ENABLE_DEBUG+; +** +CMAKE_BUILD_TYPE+ is driven by +BR2_ENABLE_RUNTIME_DEBUG+; ** +CMAKE_INSTALL_PREFIX+; ** +BUILD_SHARED_LIBS+ is driven by +BR2_STATIC_LIBS+; ** +BUILD_DOC+, +BUILD_DOCS+ are disabled;package/pkg-cmake.mk +1
-1@@ -266,7 +266,7 @@ define TOOLCHAIN_CMAKE_INSTALL_FILES -e 's#@@CMAKE_SYSTEM_PROCESSOR@@#$(call qstrip,$(CMAKE_SYSTEM_PROCESSOR))#' \ -e 's#@@TOOLCHAIN_HAS_CXX@@#$(if $(BR2_INSTALL_LIBSTDCPP),1,0)#' \ -e 's#@@TOOLCHAIN_HAS_FORTRAN@@#$(if $(BR2_TOOLCHAIN_HAS_FORTRAN),1,0)#' \ - -e 's#@@CMAKE_BUILD_TYPE@@#$(if $(BR2_ENABLE_DEBUG),Debug,Release)#' \ + -e 's#@@CMAKE_BUILD_TYPE@@#$(if $(BR2_ENABLE_RUNTIME_DEBUG),Debug,Release)#' \ $(TOPDIR)/support/misc/toolchainfile.cmake.in \ > $(HOST_DIR)/share/buildroot/toolchainfile.cmake $(Q)$(INSTALL) -D -m 0644 support/misc/Buildroot.cmake \
PATCH v3 4/15 package/flare-engine: update explicit setting of CMAKE_BUILD_TYPE
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
The flare-engine package forces CMAKE_BUILD_TYPE=RelWithDebInfo in case Buildroot would normally set CMAKE_BUILD_TYPE=Debug. Previously, this would happen if BR2_ENABLE_DEBUG is set, but now we should check BR2_ENABLE_RUNTIME_DEBUG instead.
--- package/flare-engine/flare-engine.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/flare-engine/flare-engine.mk +1 -1
@@ -15,7 +15,7 @@ FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf FLARE_ENGINE_CONF_OPTS += -DBINDIR=bin -DDATADIR=share/flare # Don't use the default Debug type as it adds -pg (gprof) -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) FLARE_ENGINE_CONF_OPTS += -DCMAKE_BUILD_TYPE=RelWithDebInfo endif
Signature · 1 line
2.26.3
PATCH v3 4/15 package/flare-engine: update explicit setting of CMAKE_BUILD_TYPE
Quoted 17 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
The flare-engine package forces CMAKE_BUILD_TYPE=RelWithDebInfo in case Buildroot would normally set CMAKE_BUILD_TYPE=Debug. Previously, this would happen if
BR2_ENABLE_DEBUGis set, but now we should checkBR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/flare-engine/flare-engine.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/flare-engine/flare-engine.mk +0
-0
package/flare-engine/flare-engine.mk FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf · line 17
Quoted 3 lines
package/flare-engine/flare-engine.mk +0
-0@@ -15,7 +15,7 @@ FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf FLARE_ENGINE_CONF_OPTS += -DBINDIR=bin -DDATADIR=share/flare # Don't use the default Debug type as it adds -pg (gprof)
Debug type is no longer default :-)
package/flare-engine/flare-engine.mk FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf · line 19
Quoted 3 lines
package/flare-engine/flare-engine.mk +1
-1-ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) FLARE_ENGINE_CONF_OPTS += -DCMAKE_BUILD_TYPE=RelWithDebInfo
Since CMAKE_BUILD_TYPE is only used by flare-engine to set -O2 -g flags, maybe
it would be better/cleaner to just unconditionally set build type to Release?
Regards,
Arnout
Quoted 3 lines
package/flare-engine/flare-engine.mk +0
-0endif
PATCH v3 4/15 package/flare-engine: update explicit setting of CMAKE_BUILD_TYPE
El mar, 25 may 2021 a las 22:51, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 27 lines · Thomas De Schampheleire
Quoted 17 lines
From: Thomas De Schampheleire <[email protected]>
The flare-engine package forces CMAKE_BUILD_TYPE=RelWithDebInfo in case Buildroot would normally set CMAKE_BUILD_TYPE=Debug. Previously, this would happen if
BR2_ENABLE_DEBUGis set, but now we should checkBR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/flare-engine/flare-engine.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/flare-engine/flare-engine.mk +0
-0package/flare-engine/flare-engine.mk FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf · line 17
Quoted 3 lines
package/flare-engine/flare-engine.mk +0
-0@@ -15,7 +15,7 @@ FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf FLARE_ENGINE_CONF_OPTS += -DBINDIR=bin -DDATADIR=share/flare # Don't use the default Debug type as it adds -pg (gprof)Debug type is no longer default :-)
Quoted 7 lines
package/flare-engine/flare-engine.mk FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf · line 19
Quoted 3 lines
package/flare-engine/flare-engine.mk +1
-1-ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) FLARE_ENGINE_CONF_OPTS += -DCMAKE_BUILD_TYPE=RelWithDebInfoSince
CMAKE_BUILD_TYPEis only used by flare-engine to set -O2 -g flags, maybe
it would be better/cleaner to just unconditionally set build type to Release?
I was checking the situation with BR2_ENABLE_DEBUG=y and see that the flags of Buildroot do not survive. E.g. compilation commands are:
... -Os -g2 -D_FORTIFY_SOURCE=1 -O2 -g0 ...
The '-O2 -g0' are from the 'Release' build type, set by flare-engine itself, and '-Os -g2' is what Buildroot sets.
So it means that in the current state of things, this patch would actually remove debugging symbols when requested, and so would using 'Release' unconditionally.
The pkg-cmake.mk intends to pass its flags to each cmake package and they should survive. In flare-engine this principle is violated. So unless there is a better way to fix that, we may actually need to keep the existing check on BR2_ENABLE_DEBUG and set RelWithDebInfo in that case.
/Thomas
PATCH v3 4/15 package/flare-engine: update explicit setting of CMAKE_BUILD_TYPE
Quoted 45 lines · Thomas De Schampheleire
El mar, 25 may 2021 a las 22:51, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 27 lines · Thomas De Schampheleire
Quoted 17 lines
From: Thomas De Schampheleire <[email protected]>
The flare-engine package forces CMAKE_BUILD_TYPE=RelWithDebInfo in case Buildroot would normally set CMAKE_BUILD_TYPE=Debug. Previously, this would happen if
BR2_ENABLE_DEBUGis set, but now we should checkBR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/flare-engine/flare-engine.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/flare-engine/flare-engine.mk +0
-0package/flare-engine/flare-engine.mk FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf · line 17
Quoted 3 lines
package/flare-engine/flare-engine.mk +0
-0@@ -15,7 +15,7 @@ FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf FLARE_ENGINE_CONF_OPTS += -DBINDIR=bin -DDATADIR=share/flare # Don't use the default Debug type as it adds -pg (gprof)Debug type is no longer default :-)
Quoted 7 lines
package/flare-engine/flare-engine.mk FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf · line 19
Quoted 3 lines
package/flare-engine/flare-engine.mk +1
-1-ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) FLARE_ENGINE_CONF_OPTS += -DCMAKE_BUILD_TYPE=RelWithDebInfoSince
CMAKE_BUILD_TYPEis only used by flare-engine to set -O2 -g flags, maybe
it would be better/cleaner to just unconditionally set build type to Release?I was checking the situation with BR2_ENABLE_DEBUG=y and see that the flags of Buildroot do not survive. E.g. compilation commands are:
... -Os -g2 -D_FORTIFY_SOURCE=1 -O2 -g0 ...
The '-O2 -g0' are from the 'Release' build type, set by flare-engine itself, and '-Os -g2' is what Buildroot sets.
Quoted 8 lines
So it means that in the current state of things, this patch would actually remove debugging symbols when requested, and so would using 'Release' unconditionally.
The pkg-cmake.mk intends to pass its flags to each cmake package and they should survive. In flare-engine this principle is violated. So unless there is a better way to fix that, we may actually need to keep the existing check onBR2_ENABLE_DEBUGand set RelWithDebInfo in that case.
There is actually a different way - set CMAKE_BUILD_TYPE to Buildroot (or
anything else that is not covered by the CMakeLists.txt).
Regards,
Arnout
PATCH v3 4/15 package/flare-engine: update explicit setting of CMAKE_BUILD_TYPE
El mi?, 26 may 2021 a las 17:18, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 58 lines · Thomas De Schampheleire
Quoted 45 lines
El mar, 25 may 2021 a las 22:51, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 27 lines · Thomas De Schampheleire
Quoted 17 lines
From: Thomas De Schampheleire <[email protected]>
The flare-engine package forces CMAKE_BUILD_TYPE=RelWithDebInfo in case Buildroot would normally set CMAKE_BUILD_TYPE=Debug. Previously, this would happen if
BR2_ENABLE_DEBUGis set, but now we should checkBR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/flare-engine/flare-engine.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/flare-engine/flare-engine.mk +0
-0package/flare-engine/flare-engine.mk FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf · line 17
Quoted 3 lines
package/flare-engine/flare-engine.mk +0
-0@@ -15,7 +15,7 @@ FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf FLARE_ENGINE_CONF_OPTS += -DBINDIR=bin -DDATADIR=share/flare # Don't use the default Debug type as it adds -pg (gprof)Debug type is no longer default :-)
Quoted 7 lines
package/flare-engine/flare-engine.mk FLARE_ENGINE_DEPENDENCIES += sdl2 sdl2_image sdl2_mixer sdl2_ttf · line 19
Quoted 3 lines
package/flare-engine/flare-engine.mk +1
-1-ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) FLARE_ENGINE_CONF_OPTS += -DCMAKE_BUILD_TYPE=RelWithDebInfoSince
CMAKE_BUILD_TYPEis only used by flare-engine to set -O2 -g flags, maybe
it would be better/cleaner to just unconditionally set build type to Release?I was checking the situation with BR2_ENABLE_DEBUG=y and see that the flags of Buildroot do not survive. E.g. compilation commands are:
... -Os -g2 -D_FORTIFY_SOURCE=1 -O2 -g0 ...
The '-O2 -g0' are from the 'Release' build type, set by flare-engine itself, and '-Os -g2' is what Buildroot sets.
Quoted 8 lines
So it means that in the current state of things, this patch would actually remove debugging symbols when requested, and so would using 'Release' unconditionally.
The pkg-cmake.mk intends to pass its flags to each cmake package and they should survive. In flare-engine this principle is violated. So unless there is a better way to fix that, we may actually need to keep the existing check onBR2_ENABLE_DEBUGand set RelWithDebInfo in that case.
Quoted 2 lines
There is actually a different way - set
CMAKE_BUILD_TYPEto Buildroot (or
anything else that is not covered by the CMakeLists.txt).
Thanks, this indeed works.
PATCH v3 5/15 package/sysrepo: use default CMAKE_BUILD_TYPE for host package
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
Use the default build type for host-sysrepo.
In the current version of sysrepo, this happens to be 'Debug'. As 'Debug' also enables tests, explicitly disable them.
--- package/sysrepo/sysrepo.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
package/sysrepo/sysrepo.mk +2 -1
@@ -26,8 +26,9 @@ define SYSREPO_INSTALL_INIT_SYSV endef HOST_SYSREPO_CONF_OPTS = \ - -DCMAKE_BUILD_TYPE=Release \ -DBUILD_EXAMPLES=OFF \ + -DENABLE_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF \ -DREPO_PATH=$(TARGET_DIR)/etc/sysrepo $(eval $(cmake-package))
Signature · 1 line
2.26.3
PATCH v3 5/15 package/sysrepo: use default CMAKE_BUILD_TYPE for host package
Quoted 8 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
Use the default build type for host-sysrepo.
In the current version of sysrepo, this happens to be 'Debug'. As 'Debug' also enables tests, explicitly disable them.Suggested-by Arnout Vandecappelle <[email protected]>Signed-off-by Thomas De Schampheleire <[email protected]>
Regards,
Arnout
Quoted 20 lines
--- package/sysrepo/sysrepo.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)package/sysrepo/sysrepo.mk +2
-1@@ -26,8 +26,9 @@ define SYSREPO_INSTALL_INIT_SYSV endef HOST_SYSREPO_CONF_OPTS = \ - -DCMAKE_BUILD_TYPE=Release \ -DBUILD_EXAMPLES=OFF \ + -DENABLE_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF \ -DREPO_PATH=$(TARGET_DIR)/etc/sysrepo $(eval $(cmake-package))
PATCH v3 5/15 package/sysrepo: use default CMAKE_BUILD_TYPE for host package
Hi Thomas,
Am Di., 25. Mai 2021 um 22:54 Uhr schrieb Arnout Vandecappelle <[email protected]>:
Quoted 14 lines · Thomas De Schampheleire
Quoted 8 lines
From: Thomas De Schampheleire <[email protected]>
Use the default build type for host-sysrepo.
In the current version of sysrepo, this happens to be 'Debug'. As 'Debug' also enables tests, explicitly disable them.Suggested-by Arnout Vandecappelle <[email protected]>Signed-off-by Thomas De Schampheleire <[email protected]>
Quoted 24 lines
Regards,
ArnoutQuoted 20 lines
--- package/sysrepo/sysrepo.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)package/sysrepo/sysrepo.mk +2
-1@@ -26,8 +26,9 @@ define SYSREPO_INSTALL_INIT_SYSV endef HOST_SYSREPO_CONF_OPTS = \ - -DCMAKE_BUILD_TYPE=Release \ -DBUILD_EXAMPLES=OFF \ + -DENABLE_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF \ -DREPO_PATH=$(TARGET_DIR)/etc/sysrepo $(eval $(cmake-package))
PATCH v3 6/15 package/sysrepo: remove explicit setting of CMAKE_BUILD_TYPE
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
sysrepo explicitly sets CMAKE_BUILD_TYPE=Release, ignoring any possible value of BR2_ENABLE_DEBUG (previously) or BR2_ENABLE_RUNTIME_DEBUG (now).
With the introduction of BR2_ENABLE_RUNTIME_DEBUG, this change should no longer be necessary. Users that do not wish to have additional runtime debugging just keep BR2_ENABLE_RUNTIME_DEBUG disabled (default value).
As the 'Debug' build type enables tests, disable them explicitly. As the 'Debug' build type uses a custom REPO_PATH which does not exist on target, force /etc/sysrepo like in the 'Release' build type.
--- package/sysrepo/sysrepo.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
package/sysrepo/sysrepo.mk +4 -2
@@ -13,8 +13,10 @@ SYSREPO_DEPENDENCIES = libyang pcre host-sysrepo HOST_SYSREPO_DEPENDENCIES = host-libyang host-pcre SYSREPO_CONF_OPTS = \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_EXAMPLES=$(if $(BR2_PACKAGE_SYSREPO_EXAMPLES),ON,OFF) + -DBUILD_EXAMPLES=$(if $(BR2_PACKAGE_SYSREPO_EXAMPLES),ON,OFF) \ + -DENABLE_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF \ + -DREPO_PATH=/etc/sysrepo ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) SYSREPO_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
Signature · 1 line
2.26.3
PATCH v3 6/15 package/sysrepo: remove explicit setting of CMAKE_BUILD_TYPE
Quoted 9 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
sysrepo explicitly sets CMAKE_BUILD_TYPE=Release, ignoring any possible value of
BR2_ENABLE_DEBUG(previously) orBR2_ENABLE_RUNTIME_DEBUG(now).With the introduction of
BR2_ENABLE_RUNTIME_DEBUG, this change should no longer be necessary. Users that do not wish to have additional runtime debugging just keepBR2_ENABLE_RUNTIME_DEBUGdisabled (default value).
Quoted 5 lines
As the 'Debug' build type enables tests, disable them explicitly. As the 'Debug' build type uses a custom
REPO_PATHwhich does not exist on target, force/etc/sysrepolike in the 'Release' build type.Signed-off-by Thomas De Schampheleire <[email protected]>
Although I think this could have been squashed with the previous patch.
Regards,
Arnout
Quoted 22 lines
--- package/sysrepo/sysrepo.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)package/sysrepo/sysrepo.mk +4
-2@@ -13,8 +13,10 @@ SYSREPO_DEPENDENCIES = libyang pcre host-sysrepo HOST_SYSREPO_DEPENDENCIES = host-libyang host-pcre SYSREPO_CONF_OPTS = \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_EXAMPLES=$(if $(BR2_PACKAGE_SYSREPO_EXAMPLES),ON,OFF) + -DBUILD_EXAMPLES=$(if $(BR2_PACKAGE_SYSREPO_EXAMPLES),ON,OFF) \ + -DENABLE_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF \ + -DREPO_PATH=/etc/sysrepo ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) SYSREPO_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
PATCH v3 6/15 package/sysrepo: remove explicit setting of CMAKE_BUILD_TYPE
Hi Thomas,
Am Di., 25. Mai 2021 um 22:56 Uhr schrieb Arnout Vandecappelle <[email protected]>:
Quoted 13 lines · Thomas De Schampheleire
Quoted 9 lines
From: Thomas De Schampheleire <[email protected]>
sysrepo explicitly sets CMAKE_BUILD_TYPE=Release, ignoring any possible value of
BR2_ENABLE_DEBUG(previously) orBR2_ENABLE_RUNTIME_DEBUG(now).With the introduction of
BR2_ENABLE_RUNTIME_DEBUG, this change should no longer be necessary. Users that do not wish to have additional runtime debugging just keepBR2_ENABLE_RUNTIME_DEBUGdisabled (default value).
Quoted 7 lines
Quoted 5 lines
As the 'Debug' build type enables tests, disable them explicitly. As the 'Debug' build type uses a custom
REPO_PATHwhich does not exist on target, force/etc/sysrepolike in the 'Release' build type.Signed-off-by Thomas De Schampheleire <[email protected]>
Quoted 28 lines
Although I think this could have been squashed with the previous patch.
Regards,
ArnoutQuoted 22 lines
--- package/sysrepo/sysrepo.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)package/sysrepo/sysrepo.mk +4
-2@@ -13,8 +13,10 @@ SYSREPO_DEPENDENCIES = libyang pcre host-sysrepo HOST_SYSREPO_DEPENDENCIES = host-libyang host-pcre SYSREPO_CONF_OPTS = \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_EXAMPLES=$(if $(BR2_PACKAGE_SYSREPO_EXAMPLES),ON,OFF) + -DBUILD_EXAMPLES=$(if $(BR2_PACKAGE_SYSREPO_EXAMPLES),ON,OFF) \ + -DENABLE_TESTS=OFF \ + -DENABLE_VALGRIND_TESTS=OFF \ + -DREPO_PATH=/etc/sysrepo ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) SYSREPO_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
PATCH v3 6/15 package/sysrepo: remove explicit setting of CMAKE_BUILD_TYPE
In reply to Arnout VandecappelleEl mar, 25 may 2021 a las 22:56, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 17 lines · Thomas De Schampheleire
Quoted 13 lines
From: Thomas De Schampheleire <[email protected]>
sysrepo explicitly sets CMAKE_BUILD_TYPE=Release, ignoring any possible value of
BR2_ENABLE_DEBUG(previously) orBR2_ENABLE_RUNTIME_DEBUG(now).With the introduction of
BR2_ENABLE_RUNTIME_DEBUG, this change should no longer be necessary. Users that do not wish to have additional runtime debugging just keepBR2_ENABLE_RUNTIME_DEBUGdisabled (default value).As the 'Debug' build type enables tests, disable them explicitly. As the 'Debug' build type uses a custom
REPO_PATHwhich does not exist on target, force/etc/sysrepolike in the 'Release' build type.
Quoted 5 lines
Quoted 1 line
Signed-off-by Thomas De Schampheleire <[email protected]>Although I think this could have been squashed with the previous patch.
I thought a separate patch was intended based on your comment:
http://patchwork.ozlabs.org/comment/2633317/
In v4 I'm sending the patch still separated but feel free to squash it.
Thanks,
Thomas
PATCH v3 6/15 package/sysrepo: remove explicit setting of CMAKE_BUILD_TYPE
Quoted 19 lines · Thomas De Schampheleire
El mar, 25 may 2021 a las 22:56, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 17 lines · Thomas De Schampheleire
Quoted 13 lines
From: Thomas De Schampheleire <[email protected]>
sysrepo explicitly sets CMAKE_BUILD_TYPE=Release, ignoring any possible value of
BR2_ENABLE_DEBUG(previously) orBR2_ENABLE_RUNTIME_DEBUG(now).With the introduction of
BR2_ENABLE_RUNTIME_DEBUG, this change should no longer be necessary. Users that do not wish to have additional runtime debugging just keepBR2_ENABLE_RUNTIME_DEBUGdisabled (default value).As the 'Debug' build type enables tests, disable them explicitly. As the 'Debug' build type uses a custom
REPO_PATHwhich does not exist on target, force/etc/sysrepolike in the 'Release' build type.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Thomas De Schampheleire <[email protected]>Although I think this could have been squashed with the previous patch.
I thought a separate patch was intended based on your comment:
http://patchwork.ozlabs.org/comment/2633317/
Good point! I should have already applied patch 5.
Regards,
Arnout
Quoted 6 lines
In v4 I'm sending the patch still separated but feel free to squash it.
Thanks,
Thomas
PATCH v3 7/15 package/boost: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUG should just steer the availability of debug symbols and should have no negative effect on performance.
Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by BR2_ENABLE_RUNTIME_DEBUG instead.
--- package/boost/boost.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/boost/boost.mk +1 -1
@@ -95,7 +95,7 @@ BOOST_OPTS += --no-cmake-config \ toolset=gcc \ threading=multi \ abi=$(BOOST_ABI) \ - variant=$(if $(BR2_ENABLE_DEBUG),debug,release) + variant=$(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release) ifeq ($(BR2_sparc64),y) BOOST_OPTS += architecture=sparc instruction-set=ultrasparc
Signature · 1 line
2.26.3
PATCH v3 7/15 package/boost: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Quoted 18 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/boost/boost.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/boost/boost.mk +0
-0
package/boost/boost.mk BOOST_OPTS += --no-cmake-config \ · line 98
Quoted 5 lines
package/boost/boost.mk +1
-1@@ -95,7 +95,7 @@ BOOST_OPTS += --no-cmake-config \ toolset=gcc \ threading=multi \ abi=$(BOOST_ABI) \ - variant=$(if $(BR2_ENABLE_DEBUG),debug,release) + variant=$(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release)
It looks like the variant does the following things:
<optimization>off <debug-symbols>on <inlining>off <runtime-debugging>on
Perhaps it would make more sense to control these individually in
user-config.jam. E.g. inlining should be controller by optimization level >= 2 IMHO.
We should probably also check if our -g and -O options are properly propagated
through the stuff that is set by bjam itself.
But that's probably for someone with actual boost expertise to tackle, so I'm
OK with applying as-is.
Regards,
Arnout
Quoted 4 lines
package/boost/boost.mk +0
-0ifeq ($(BR2_sparc64),y) BOOST_OPTS += architecture=sparc instruction-set=ultrasparc
PATCH v3 7/15 package/boost: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
El mar, 25 may 2021 a las 23:17, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 30 lines · Thomas De Schampheleire
Quoted 18 lines
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/boost/boost.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/boost/boost.mk +0
-0package/boost/boost.mk BOOST_OPTS += --no-cmake-config \ · line 98
Quoted 5 lines
package/boost/boost.mk +1
-1@@ -95,7 +95,7 @@ BOOST_OPTS += --no-cmake-config \ toolset=gcc \ threading=multi \ abi=$(BOOST_ABI) \ - variant=$(if $(BR2_ENABLE_DEBUG),debug,release) + variant=$(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release)It looks like the variant does the following things:
Quoted 4 lines
<optimization>off <debug-symbols>on <inlining>off <runtime-debugging>on
Perhaps it would make more sense to control these individually in
user-config.jam. E.g. inlining should be controller by optimization level >= 2 IMHO.
Yes, in some packages the debugging flags and other stuff are mixed and it may be needed that the .mk does something special to handle BR2_ENABLE_DEBUG and BR2_ENABLE_RUNTIME_DEBUG correctly. But normally Buildroot expects that our debug and optimization flags are passed in any case via cflags, so package build systems should not concern themselves with them anymore. But of course, there will be violations in some packages.
Quoted 3 lines
We should probably also check if our -g and -O options are properly propagated
through the stuff that is set by bjam itself.
I checked on top of this patch, with BR2_ENABLE_DEBUG=y, -O2 -g is correctly passed.
(cross-checked on one of the boost libs, not all, but I think it will be global rules).
Quoted 3 lines
But that's probably for someone with actual boost expertise to tackle, so I'm
OK with applying as-is.
Thanks,
Thomas
PATCH v3 8/15 package/oracle-mysql: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUG should just steer the availability of debug symbols and should have no negative effect on performance.
Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by BR2_ENABLE_RUNTIME_DEBUG instead.
--- package/oracle-mysql/oracle-mysql.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/oracle-mysql/oracle-mysql.mk +1 -1
@@ -95,7 +95,7 @@ ORACLE_MYSQL_CONF_OPTS += \ # Debugging is only available for the server, so no need for # this if-block outside of the server if-block -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) ORACLE_MYSQL_CONF_OPTS += --with-debug=full else ORACLE_MYSQL_CONF_OPTS += --without-debug
Signature · 1 line
2.26.3
PATCH v3 8/15 package/oracle-mysql: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Quoted 9 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>
Regards,
Arnout
Quoted 18 lines
--- package/oracle-mysql/oracle-mysql.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/oracle-mysql/oracle-mysql.mk +1
-1@@ -95,7 +95,7 @@ ORACLE_MYSQL_CONF_OPTS += \ # Debugging is only available for the server, so no need for # this if-block outside of the server if-block -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) ORACLE_MYSQL_CONF_OPTS += --with-debug=full else ORACLE_MYSQL_CONF_OPTS += --without-debug
PATCH v3 9/15 package/qt5: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUG should just steer the availability of debug symbols and should have no negative effect on performance.
Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by BR2_ENABLE_RUNTIME_DEBUG instead.
--- package/qt5/qt5base/qt5base.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/qt5/qt5base/qt5base.mk +1 -1
@@ -86,7 +86,7 @@ else QT5BASE_CONFIGURE_OPTS += -no-gbm endif -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) QT5BASE_CONFIGURE_OPTS += -debug else QT5BASE_CONFIGURE_OPTS += -release
Signature · 1 line
2.26.3
PATCH v3 9/15 package/qt5: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Quoted 9 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>
Regards,
Arnout
Quoted 18 lines
--- package/qt5/qt5base/qt5base.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/qt5/qt5base/qt5base.mk +1
-1@@ -86,7 +86,7 @@ else QT5BASE_CONFIGURE_OPTS += -no-gbm endif -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) QT5BASE_CONFIGURE_OPTS += -debug else QT5BASE_CONFIGURE_OPTS += -release
PATCH v3 10/15 package/ripgrep: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUG should just steer the availability of debug symbols and should have no negative effect on performance.
Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by BR2_ENABLE_RUNTIME_DEBUG instead.
--- package/ripgrep/ripgrep.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/ripgrep/ripgrep.mk +1 -1
@@ -18,7 +18,7 @@ RIPGREP_CARGO_OPTS = \ --target=$(RUSTC_TARGET_NAME) \ --manifest-path=$(@D)/Cargo.toml -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) RIPGREP_CARGO_BIN_SUBDIR = debug else RIPGREP_CARGO_OPTS += --release
Signature · 1 line
2.26.3
PATCH v3 10/15 package/ripgrep: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Quoted 18 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/ripgrep/ripgrep.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/ripgrep/ripgrep.mk +0
-0
package/ripgrep/ripgrep.mk RIPGREP_CARGO_OPTS = \ · line 24
Quoted 8 lines
package/ripgrep/ripgrep.mk +1
-1@@ -18,7 +18,7 @@ RIPGREP_CARGO_OPTS = \ --target=$(RUSTC_TARGET_NAME) \ --manifest-path=$(@D)/Cargo.toml -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) RIPGREP_CARGO_BIN_SUBDIR = debug else RIPGREP_CARGO_OPTS += --release
This stuff should probably be raised to the pkg-cargo level, but for now:
Regards,
Arnout
PATCH v3 11/15 package/sofia-sip: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUG should just steer the availability of debug symbols and should have no negative effect on performance.
Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by BR2_ENABLE_RUNTIME_DEBUG instead.
--- package/sofia-sip/sofia-sip.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/sofia-sip/sofia-sip.mk +1 -1
@@ -30,7 +30,7 @@ SOFIA_SIP_CONF_OPTS += \ --without-openssl endif -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) SOFIA_SIP_CONF_OPTS += --enable-ndebug endif
Signature · 1 line
2.26.3
PATCH v3 11/15 package/sofia-sip: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Quoted 18 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/sofia-sip/sofia-sip.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/sofia-sip/sofia-sip.mk +0
-0
package/sofia-sip/sofia-sip.mk SOFIA_SIP_CONF_OPTS += \ · line 34
Quoted 6 lines
package/sofia-sip/sofia-sip.mk +1
-1@@ -30,7 +30,7 @@ SOFIA_SIP_CONF_OPTS += \ --without-openssl endif -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) SOFIA_SIP_CONF_OPTS += --enable-ndebug
Actually, the logic was inverted here (already wrong in the current situation):
--enable-ndebug should be given when RUNTIME_DEBUG is *not* set.
However, I think we should define -DNDEBUG in TARGET_CPPFLAGS, so it wouldn't
be necessary to pass it explicitly here (--enable-ndebug does nothing more than defining NDEBUG).
Regards,
Arnout
Quoted 3 lines
package/sofia-sip/sofia-sip.mk +0
-0endif
PATCH v3 11/15 package/sofia-sip: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
El mar, 25 may 2021 a las 23:32, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 25 lines · Thomas De Schampheleire
Quoted 21 lines
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/sofia-sip/sofia-sip.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/sofia-sip/sofia-sip.mk +0
-0@@ -30,7 +30,7 @@ SOFIA_SIP_CONF_OPTS += \ --without-openssl endif
Quoted 6 lines
package/sofia-sip/sofia-sip.mk SOFIA_SIP_CONF_OPTS += \ · line 34
Quoted 3 lines
package/sofia-sip/sofia-sip.mk +1
-1-ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) SOFIA_SIP_CONF_OPTS += --enable-ndebugActually, the logic was inverted here (already wrong in the current situation):
--enable-ndebug should be given whenRUNTIME_DEBUGis *not* set.
Indeed, you're right. I'll add a patch to fix that first.
Quoted 5 lines
However, I think we should define -DNDEBUG in
TARGET_CPPFLAGS, so it wouldn't
be necessary to pass it explicitly here (--enable-ndebug does nothing more than defining NDEBUG).
In a previous iteration I basically did that, but dropped that patch
because it also had effect in the toolchain wrapper, which may be used
to build project-specific projects, and which caused compilation
failures when NDEBUG was unexpectedly set (e.g. variables only used
for assert statements, which got compiled away with NDEBUG). Granted,
this is actually a problem in such code, but nevertheless it was my
reality and I expect those of others too.
See http://patchwork.ozlabs.org/project/buildroot/patch/20210212135451.22786-3-patrickdepinguin at gmail.com/
and my last comment on it.
Best regards,
Thomas
PATCH v3 11/15 package/sofia-sip: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Quoted 31 lines · Thomas De Schampheleire
El mar, 25 may 2021 a las 23:32, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 24 lines · Thomas De Schampheleire
Quoted 21 lines
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/sofia-sip/sofia-sip.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/sofia-sip/sofia-sip.mk +0
-0@@ -30,7 +30,7 @@ SOFIA_SIP_CONF_OPTS += \ --without-openssl endifQuoted 5 lines
package/sofia-sip/sofia-sip.mk SOFIA_SIP_CONF_OPTS += \ · line 34
Quoted 3 lines
package/sofia-sip/sofia-sip.mk +1
-1-ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) SOFIA_SIP_CONF_OPTS += --enable-ndebugActually, the logic was inverted here (already wrong in the current situation):
--enable-ndebug should be given whenRUNTIME_DEBUGis *not* set.
Quoted 7 lines
Indeed, you're right. I'll add a patch to fix that first.
Quoted 3 lines
However, I think we should define -DNDEBUG in
TARGET_CPPFLAGS, so it wouldn't
be necessary to pass it explicitly here (--enable-ndebug does nothing more than defining NDEBUG).In a previous iteration I basically did that, but dropped that patch because it also had effect in the toolchain wrapper,
No it doesn't... TARGET_CFLAGS isn't set in the toolchain wrapper. Only
arch-specific options are there, and BR2_TARGET_OPTIMIZATION (which is intended for arch-specific -m flags).
Quoted 3 lines
which may be used
to build project-specific projects, and which caused compilation failures when NDEBUG was unexpectedly set
If it's built by Buildroot, then of course it *is* going to be passed in
through CFLAGS.
Quoted 4 lines
(e.g. variables only used
for assert statements, which got compiled away with NDEBUG). Granted, this is actually a problem in such code, but nevertheless it was my reality and I expect those of others too.
If you don't want to fix the actual issue, you can always add -UNDEBUG in the
package-specific CFLAGS or in the package build system.
Regards,
Arnout
Quoted 2 lines
See http://patchwork.ozlabs.org/project/buildroot/patch/20210212135451.22786-3-patrickdepinguin at gmail.com/
and my last comment on it.
PATCH v3 11/15 package/sofia-sip: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Hello,
El vie, 28 may 2021 a las 23:07, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 40 lines · Thomas De Schampheleire
Quoted 36 lines
El mar, 25 may 2021 a las 23:32, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 24 lines · Thomas De Schampheleire
Quoted 21 lines
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/sofia-sip/sofia-sip.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/sofia-sip/sofia-sip.mk +0
-0@@ -30,7 +30,7 @@ SOFIA_SIP_CONF_OPTS += \ --without-openssl endifQuoted 5 lines
package/sofia-sip/sofia-sip.mk SOFIA_SIP_CONF_OPTS += \ · line 34
Quoted 3 lines
package/sofia-sip/sofia-sip.mk +1
-1-ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) SOFIA_SIP_CONF_OPTS += --enable-ndebugActually, the logic was inverted here (already wrong in the current situation):
--enable-ndebug should be given whenRUNTIME_DEBUGis *not* set.Indeed, you're right. I'll add a patch to fix that first.
Quoted 3 lines
However, I think we should define -DNDEBUG in
TARGET_CPPFLAGS, so it wouldn't
be necessary to pass it explicitly here (--enable-ndebug does nothing more than defining NDEBUG).
Quoted 6 lines
Quoted 2 lines
In a previous iteration I basically did that, but dropped that patch because it also had effect in the toolchain wrapper,
No it doesn't...
TARGET_CFLAGSisn't set in the toolchain wrapper. Only
arch-specific options are there, andBR2_TARGET_OPTIMIZATION(which is intended for arch-specific -m flags).
I had to reproduce the issue in order to understand where my conclusion was wrong.
The compiler wrapper indeed does not pass these flags.
The problem in our case is that the -DNDEBUG is passed via a <project>-config script to external compilations. In our case, xenomai is used, and it provides a 'xeno-config' script to get the correct compilation and linker flags. The generated file contains the flags set by Buildroot in XENO_BASE_CFLAGS . With the mentioned patch, this would include -DNDEBUG.
And the output of 'xeno-config [...] --cflags' was used in the compilation of the external project.
We can work around that by filtering the output of 'xeno-config' in our local makefiles.
Note that Thomas Petazzoni had initial doubts on the mentioned patch
(http://patchwork.ozlabs.org/project/buildroot/patch/20210212135451.22786-3-patrickdepinguin at gmail.com/).
If you think we should re-add it to the series, I will do it.
Thanks,
Thomas
PATCH v3 12/15 package/uclibc: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUG should just steer the availability of debug symbols and should have no negative effect on performance.
Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by BR2_ENABLE_RUNTIME_DEBUG instead.
--- package/uclibc/uclibc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/uclibc/uclibc.mk +1 -1
@@ -205,7 +205,7 @@ endif # # Debug # -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y) define UCLIBC_DEBUG_CONFIG $(call KCONFIG_ENABLE_OPT,DODEBUG) endef
Signature · 1 line
2.26.3
PATCH v3 12/15 package/uclibc: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Quoted 18 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/uclibc/uclibc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/uclibc/uclibc.mk +0
-0
package/uclibc/uclibc.mk endif · line 208
Quoted 5 lines
package/uclibc/uclibc.mk +1
-1@@ -205,7 +205,7 @@ endif # # Debug # -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y)
This one I'm not so sure... In UClibc, we don't (want to) enforce the -g/-O
options as strictly. In fact, we don't pass them down into uClibc at all. And indeed, the DODEBUG option mostly controls debug symbols and optimisation. The only "runtime debugging" difference that I can see are:
- different way of handling SSP errors;
- debug messages in linuxthreads.
So I don't think this patch should be applied.
Regards,
Arnout
Quoted 4 lines
package/uclibc/uclibc.mk +0
-0define UCLIBC_DEBUG_CONFIG $(call KCONFIG_ENABLE_OPT,DODEBUG) endef
PATCH v3 12/15 package/uclibc: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
El mar, 25 may 2021 a las 23:43, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 33 lines · Thomas De Schampheleire
Quoted 18 lines
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/uclibc/uclibc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/uclibc/uclibc.mk +0
-0package/uclibc/uclibc.mk endif · line 208
Quoted 5 lines
package/uclibc/uclibc.mk +1
-1@@ -205,7 +205,7 @@ endif # # Debug # -ifeq ($(BR2_ENABLE_DEBUG),y) +ifeq ($(BR2_ENABLE_RUNTIME_DEBUG),y)This one I'm not so sure... In UClibc, we don't (want to) enforce the -g/-O
options as strictly. In fact, we don't pass them down into uClibc at all. And indeed, the DODEBUG option mostly controls debug symbols and optimisation. The only "runtime debugging" difference that I can see are:
Quoted 4 lines
- different way of handling SSP errors;
- debug messages in linuxthreads.So I don't think this patch should be applied.
OK, I'll drop it from the series, thanks.
/Thomas
PATCH v3 13/15 package/zmqpp: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUG should just steer the availability of debug symbols and should have no negative effect on performance.
Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by BR2_ENABLE_RUNTIME_DEBUG instead.
--- package/zmqpp/zmqpp.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/zmqpp/zmqpp.mk +1 -1
@@ -19,7 +19,7 @@ ZMQPP_LDFLAGS = $(TARGET_LDFLAGS) -lpthread # -ffast-math -finline-functions -fomit-frame-pointer are disabled, # so only set CONFIG for the non-affected cases. ifneq ($(BR2_or1k):$(BR2_TOOLCHAIN_GCC_AT_LEAST_6),y:) -ZMQPP_CONFIG = $(if $(BR2_ENABLE_DEBUG),debug,release) +ZMQPP_CONFIG = $(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release) endif ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
Signature · 1 line
2.26.3
PATCH v3 13/15 package/zmqpp: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Quoted 18 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/zmqpp/zmqpp.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/zmqpp/zmqpp.mk +0
-0
package/zmqpp/zmqpp.mk ZMQPP_LDFLAGS = $(TARGET_LDFLAGS) -lpthread · line 22
Quoted 5 lines
package/zmqpp/zmqpp.mk +1
-1@@ -19,7 +19,7 @@ ZMQPP_LDFLAGS = $(TARGET_LDFLAGS) -lpthread # -ffast-math -finline-functions -fomit-frame-pointer are disabled, # so only set CONFIG for the non-affected cases. ifneq ($(BR2_or1k):$(BR2_TOOLCHAIN_GCC_AT_LEAST_6),y:) -ZMQPP_CONFIG = $(if $(BR2_ENABLE_DEBUG),debug,release) +ZMQPP_CONFIG = $(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release)
This is the effect of CONFIG:
CONFIG_FLAGS =
ifeq ($(CONFIG),debug)
CONFIG_FLAGS = -g -fno-inline -ftemplate-depth-1000
endif
ifeq ($(CONFIG),valgrind)
CONFIG_FLAGS = -g -O1 -DNO_DEBUG_LOG -DNO_TRACE_LOG
endif
ifeq ($(CONFIG),max)
CONFIG_FLAGS = -O3 -funroll-loops -ffast-math -finline-functions
-fomit-frame-pointer -DNDEBUG
endif
ifneq (,$(findstring $(CONFIG),release loadtest))
CONFIG_FLAGS = -O3 -funroll-loops -ffast-math -finline-functions
-fomit-frame-pointer -DNO_DEBUG_LOG -DNO_TRACE_LOG -DNDEBUG endif
So I'm OK with the release case, but I think maybe in the RUNTIME_DEBUG case we
don't want to set anything at all. Neither -fno-inline nor -ftemplate-depth is what we want, I think. So maybe we should set nothing at all?
Regards,
Arnout
Quoted 4 lines
package/zmqpp/zmqpp.mk +0
-0endif ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
PATCH v3 13/15 package/zmqpp: use BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
El mar, 25 may 2021 a las 23:48, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 47 lines · Thomas De Schampheleire
Quoted 18 lines
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/zmqpp/zmqpp.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/zmqpp/zmqpp.mk +0
-0package/zmqpp/zmqpp.mk ZMQPP_LDFLAGS = $(TARGET_LDFLAGS) -lpthread · line 22
Quoted 5 lines
package/zmqpp/zmqpp.mk +1
-1@@ -19,7 +19,7 @@ ZMQPP_LDFLAGS = $(TARGET_LDFLAGS) -lpthread # -ffast-math -finline-functions -fomit-frame-pointer are disabled, # so only set CONFIG for the non-affected cases. ifneq ($(BR2_or1k):$(BR2_TOOLCHAIN_GCC_AT_LEAST_6),y:) -ZMQPP_CONFIG = $(if $(BR2_ENABLE_DEBUG),debug,release) +ZMQPP_CONFIG = $(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release)This is the effect of CONFIG:
CONFIG_FLAGS=
ifeq ($(CONFIG),debug)
CONFIG_FLAGS= -g -fno-inline -ftemplate-depth-1000
endif
ifeq ($(CONFIG),valgrind)
CONFIG_FLAGS= -g -O1 -DNO_DEBUG_LOG -DNO_TRACE_LOG
endif
ifeq ($(CONFIG),max)
CONFIG_FLAGS= -O3 -funroll-loops -ffast-math -finline-functions
-fomit-frame-pointer -DNDEBUG
endif
ifneq (,$(findstring $(CONFIG),release loadtest))
CONFIG_FLAGS= -O3 -funroll-loops -ffast-math -finline-functions
-fomit-frame-pointer -DNO_DEBUG_LOG -DNO_TRACE_LOG -DNDEBUG endif
Quoted 3 lines
So I'm OK with the release case, but I think maybe in the
RUNTIME_DEBUGcase we
don't want to set anything at all. Neither -fno-inline nor -ftemplate-depth is what we want, I think. So maybe we should set nothing at all?
Ok, I will set 'buildroot' instead of 'debug' (empty value could be
confusing, as the CONFIG variable is also passed to 'BUILD_ENV', even though that is currently unused).
Thanks,
Thomas
PATCH v3 14/15 package/pkg-meson.mk: determine 'buildtype' based on BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUG should just steer the availability of debug symbols and should have no negative effect on performance.
Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by BR2_ENABLE_RUNTIME_DEBUG instead.
--- package/pkg-meson.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-meson.mk +1 -1
@@ -89,7 +89,7 @@ define $(2)_CONFIGURE_CMDS --prefix=/usr \ --libdir=lib \ --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \ - --buildtype=$(if $(BR2_ENABLE_DEBUG),debug,release) \ + --buildtype=$(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release) \ --cross-file=$$($$(PKG)_SRCDIR)/build/cross-compilation.conf \ -Dstrip=false \ -Dbuild.pkg_config_path=$$(HOST_DIR)/lib/pkgconfig \
Signature · 1 line
2.26.3
PATCH v3 14/15 package/pkg-meson.mk: determine 'buildtype' based on BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Quoted 18 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/pkg-meson.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/pkg-meson.mk +0
-0
package/pkg-meson.mk define $(2)_CONFIGURE_CMDS · line 92
Quoted 5 lines
package/pkg-meson.mk +1
-1@@ -89,7 +89,7 @@ define $(2)_CONFIGURE_CMDS --prefix=/usr \ --libdir=lib \ --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \ - --buildtype=$(if $(BR2_ENABLE_DEBUG),debug,release) \ + --buildtype=$(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release) \
I haven't checked yet in the source code what the effect of buildtype is, nor
have I tested it, but the documentation says:
For setting optimization levels and
toggling debug, you can either set the buildtype option, or you can set the optimization and debug options which give finer control over the same. Whichever you decide to use, the other will be deduced from it. For example, -Dbuildtype=debugoptimized is the same as -Ddebug=true -Doptimization=2 and vice-versa. This table documents the two-way mapping:
| buildtype | debug | optimization | | --------- | ----- | ------------ | | plain | false | 0 | | debug | true | 0 | | debugoptimized | true | 2 | | release | false | 3 | | minsize | true | s |
All other combinations of debug and optimization set buildtype to 'custom'.
So I think this should be just 'custom', regardless of RUNTIME_DEBUG.
That said, it *is* possible that the debug option has more effect than just
'-g'... So I checked the meson source. There are a bunch of effects.
* For gcc, it just sets -g/-O options.
* On windows and mac, there are a bunch of other effects but I didn't look at that.
* For boost, it selects the "g" suffix if necessary - but we install without that suffix anyway.
* For rust, it only has effect on optimisation flags. Note that we currently don't set optimisation flags correctly for rust, so we have something to learn there.
* For fortran, java, cuda, it als only affects optimisation and debug flags.
* There is one more relevant effect: there is an option "b_ndebug", which defaults to false. A project can set it to "if-release" - in that case, -DNDEBUG is passed if the buildtype if 'release'.
So it sounds like setting buildtype to release in the RUNTIME_DEBUG case is the
right thing to do. There is one caveat (but this is already the case now): it will force the optimisation to -O3, and I believe that that will override the optimisation option we set in cflags. But that's essentially what happens now already, so not something that needs to be addressed by this series.
In the non-RUNTIME_DEBUG case, however, I don't think we should set to "debug",
because that will add a -g option. Maybe "plain" is the best option.
Alternatively, we leave buildtype alone, and instead set debug to false,
optimization to the value corresponding to the optimisation level chosen, and b_ndebug to true or false based on RUNTIME_DEBUG.
Regards,
Arnout
Quoted 4 lines
package/pkg-meson.mk +0
-0--cross-file=$$($$(PKG)_SRCDIR)/build/cross-compilation.conf \ -Dstrip=false \ -Dbuild.pkg_config_path=$$(HOST_DIR)/lib/pkgconfig \
PATCH v3 14/15 package/pkg-meson.mk: determine 'buildtype' based on BR2_ENABLE_RUNTIME_DEBUG iso BR2_ENABLE_DEBUG
Hi Arnout,
El vie, 28 may 2021 a las 23:01, Arnout Vandecappelle (<[email protected]>) escribi?:
Quoted 75 lines · Thomas De Schampheleire
Quoted 18 lines
From: Thomas De Schampheleire <[email protected]>
BR2_ENABLE_DEBUGshould just steer the availability of debug symbols and should have no negative effect on performance.Introduction of 'assert' statements, 'debug'-type builds with additional logging, etc. should be steered by
BR2_ENABLE_RUNTIME_DEBUGinstead.Signed-off-by Thomas De Schampheleire <[email protected]>--- package/pkg-meson.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/pkg-meson.mk +0
-0package/pkg-meson.mk define $(2)_CONFIGURE_CMDS · line 92
Quoted 5 lines
package/pkg-meson.mk +1
-1@@ -89,7 +89,7 @@ define $(2)_CONFIGURE_CMDS --prefix=/usr \ --libdir=lib \ --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \ - --buildtype=$(if $(BR2_ENABLE_DEBUG),debug,release) \ + --buildtype=$(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release) \I haven't checked yet in the source code what the effect of buildtype is, nor
have I tested it, but the documentation says:For setting optimization levels and
toggling debug, you can either set thebuildtypeoption, or you can set theoptimizationanddebugoptions which give finer control over the same. Whichever you decide to use, the other will be deduced from it. For example,-Dbuildtype=debugoptimizedis the same as-Ddebug=true -Doptimization=2and vice-versa. This table documents the two-way mapping:| buildtype | debug | optimization | | --------- | ----- | ------------ | | plain | false | 0 | | debug | true | 0 | | debugoptimized | true | 2 | | release | false | 3 | | minsize | true | s |All other combinations of
debugandoptimizationsetbuildtypeto'custom'.So I think this should be just 'custom', regardless of
RUNTIME_DEBUG.That said, it *is* possible that the debug option has more effect than just
'-g'... So I checked the meson source. There are a bunch of effects.* For gcc, it just sets -g/-O options.
* On windows and mac, there are a bunch of other effects but I didn't look at that.
* For boost, it selects the "g" suffix if necessary - but we install without that suffix anyway.
* For rust, it only has effect on optimisation flags. Note that we currently don't set optimisation flags correctly for rust, so we have something to learn there.
* For fortran, java, cuda, it als only affects optimisation and debug flags.
* There is one more relevant effect: there is an option "
b_ndebug", which defaults to false. A project can set it to "if-release" - in that case, -DNDEBUG is passed if the buildtype if 'release'.
Quoted 5 lines
So it sounds like setting buildtype to release in the
RUNTIME_DEBUGcase is the
right thing to do. There is one caveat (but this is already the case now): it will force the optimisation to -O3, and I believe that that will override the optimisation option we set in cflags. But that's essentially what happens now already, so not something that needs to be addressed by this series.
I think you swapped the RUNTIME_DEBUG value:
The above is for 'RUNTIME_DEBUG not set', i.e. default case --> release
Quoted 3 lines
In the non-RUNTIME_DEBUG case, however, I don't think we should set to "debug",
because that will add a -g option. Maybe "plain" is the best option.
And this is about RUNTIME_DEBUG=y .
I tested with 'libsigc', and the compilation flags Buildroot passes explicitly for optimization and debugging are put last, so the '-g' passed due to buildtype=debug is overridden by the '-g0' we now pass explicitly if BR2_ENABLE_DEBUG is off.
So I think the proposed patch is actually fine.
Of course, packages where the buildroot flags do not 'survive' will have a different outcome, but this is a problem in its own right, and to be fixed for these packages.
Quoted 5 lines
Alternatively, we leave buildtype alone, and instead set debug to false,
optimization to the value corresponding to the optimisation level chosen, andb_ndebugto true or false based onRUNTIME_DEBUG.
At this moment I don't have a compelling reason to change it, but please let me know if you think otherwise.
Thanks,
Thomas
PATCH v3 15/15 utils/genrandconfig: also test BR2_ENABLE_RUNTIME_DEBUG
In reply to Thomas De SchampheleireFrom: Thomas De Schampheleire <[email protected]>
... similar to BR2_ENABLE_DEBUG.
--- utils/genrandconfig | 2 ++ 1 file changed, 2 insertions(+)
utils/genrandconfig +2 -0
@@ -357,6 +357,8 @@ def gen_config(args): # Amend the configuration with a few things. if randint(0, 20) == 0: configlines.append("BR2_ENABLE_DEBUG=y\n") + if randint(0, 20) == 0: + configlines.append("BR2_ENABLE_RUNTIME_DEBUG=y\n") if randint(0, 1) == 0: configlines.append("BR2_INIT_BUSYBOX=y\n") elif randint(0, 15) == 0:
Signature · 1 line
2.26.3
PATCH v3 15/15 utils/genrandconfig: also test BR2_ENABLE_RUNTIME_DEBUG
Quoted 5 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
... similar to
BR2_ENABLE_DEBUG.Signed-off-by Thomas De Schampheleire <[email protected]>
utils/genrandconfig def gen_config(args): · line 360
Quoted 13 lines
--- utils/genrandconfig | 2 ++ 1 file changed, 2 insertions(+)utils/genrandconfig +1
-0@@ -357,6 +357,8 @@ def gen_config(args): # Amend the configuration with a few things. if randint(0, 20) == 0: configlines.append("BR2_ENABLE_DEBUG=y\n") + if randint(0, 20) == 0:
Although actually, I think we should increase the frequency of all these
options quite a lot...
Regards,
Arnout
Quoted 5 lines
utils/genrandconfig +1
-0+ configlines.append("BR2_ENABLE_RUNTIME_DEBUG=y\n") if randint(0, 1) == 0: configlines.append("BR2_INIT_BUSYBOX=y\n") elif randint(0, 15) == 0:
v3 cover Introduce BR2_ENABLE_RUNTIME_DEBUG
In reply to Thomas De SchampheleireQuoted 11 lines · Thomas De Schampheleire
From: Thomas De Schampheleire <[email protected]>
Hello,
This patch series started with as main goal to fix the performance degradation found when testing gRPC in combination with
BR2_ENABLE_DEBUG.Its implementation strives to settle a discussion that has happened several times, regarding the
CMAKE_BUILD_TYPEthat Buildroot should set, by not forcing anything upon the user but allowing the choice.
Quoted 5 lines
Additionally, it cleans up some related changes done in specific packages.
After this series, there are still packages that set
CMAKE_BUILD_TYPEexplicitly, but the associated comments indicate that they are needed to avoid build failures, so they are not touched.
There are probably also lots of (non-cmake) packages that have options that
should depend on this new config option, but we don't need to fix the world right away.
For the record: I'm in agreement with this series (with some small comments
which I'll make in individual patches). However, it's a bit too controversial for me to apply outright, so I'm waiting for acks from other developers.
Regards,
Arnout
Quoted 48 lines
v2: fix sysrepo after comment by Jan Kundr?t (thanks!)
v3:
- new patch setting -g0 (Arnout)
- don't set -DNDEBUG globally anymore, and drop related libjson change
- flare-engine, supertux: retain disabling of -pg option (Arnout)
- sysrepo: new patch for host-sysrepo, disable tests for target (Arnout)
- update several packages to useBR2_ENABLE_RUNTIME_DEBUGinstead ofBR2_ENABLE_DEBUGThomas De Schampheleire (15):
package/Makefile.in: pass '-g0' explicitly if !BR2_ENABLE_DEBUG
core: introduceBR2_ENABLE_RUNTIME_DEBUGpackage/pkg-cmake.mk: determineCMAKE_BUILD_TYPEdepending on
BR2_ENABLE_RUNTIME_DEBUG
package/flare-engine: update explicit setting ofCMAKE_BUILD_TYPEpackage/sysrepo: use defaultCMAKE_BUILD_TYPEfor host package package/sysrepo: remove explicit setting ofCMAKE_BUILD_TYPEpackage/boost: useBR2_ENABLE_RUNTIME_DEBUGisoBR2_ENABLE_DEBUGpackage/oracle-mysql: useBR2_ENABLE_RUNTIME_DEBUGiso
BR2_ENABLE_DEBUG
package/qt5: useBR2_ENABLE_RUNTIME_DEBUGisoBR2_ENABLE_DEBUGpackage/ripgrep: useBR2_ENABLE_RUNTIME_DEBUGisoBR2_ENABLE_DEBUGpackage/sofia-sip: useBR2_ENABLE_RUNTIME_DEBUGisoBR2_ENABLE_DEBUGpackage/uclibc: useBR2_ENABLE_RUNTIME_DEBUGisoBR2_ENABLE_DEBUGpackage/zmqpp: useBR2_ENABLE_RUNTIME_DEBUGisoBR2_ENABLE_DEBUGpackage/pkg-meson.mk: determine 'buildtype' based on
BR2_ENABLE_RUNTIME_DEBUGisoBR2_ENABLE_DEBUG
utils/genrandconfig: also testBR2_ENABLE_RUNTIME_DEBUGConfig.in | 13 +++++++++++++ docs/manual/adding-packages-cmake.txt | 2 +- package/Makefile.in | 3 +++ package/boost/boost.mk | 2 +- package/flare-engine/flare-engine.mk | 2 +- package/oracle-mysql/oracle-mysql.mk | 2 +- package/pkg-cmake.mk | 2 +- package/pkg-meson.mk | 2 +- package/qt5/qt5base/qt5base.mk | 2 +- package/ripgrep/ripgrep.mk | 2 +- package/sofia-sip/sofia-sip.mk | 2 +- package/sysrepo/sysrepo.mk | 9 ++++++--- package/uclibc/uclibc.mk | 2 +- package/zmqpp/zmqpp.mk | 2 +- utils/genrandconfig | 2 ++ 15 files changed, 35 insertions(+), 14 deletions(-)