I've been bitten by the option BR2_ENABLE_DEBUG which does not exactly do what the doc describes: config BR2_ENABLE_DEBUG bool "build packages with debugging symbols" help Build packages with debugging symbols enabled. All libraries and binaries in the 'staging' directory will have debugging symbols, which allows remote debugging even if libraries and binaries are stripped on the target. Whether libraries and binaries are stripped on the target is controlled by the BR2_STRIP_* options below. For a CMake package, this corresponds to `-DCMAKE_BUILD_TYPE=RelWithDebInfo`, however currently buildroot will pass `-DCMAKE_BUILD_TYPE=Debug` which has the effect of generating a *non-optimized* build (i.e. -O0). I suggest the following patch: diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk index db78d897d826..0a7bee685096 100644 --- a/package/pkg-cmake.mk +++ b/package/pkg-cmake.mk @@ -257,7 +257,7 @@ $(HOST_DIR)/share/buildroot/toolchainfile.cmake: -e 's#@@TARGET_FC@@#$(subst $(HOST_DIR)/,,$(call qstrip,$(TARGET_FC)))#' \ -e 's#@@CMAKE_SYSTEM_PROCESSOR@@#$(call qstrip,$(CMAKE_SYSTEM_PROCESSOR))#' \ -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_DEBUG),RelWithDebInfo,Release)#' \ $(TOPDIR)/support/misc/toolchainfile.cmake.in \ > $@
Created attachment 7201 [details] Proposed patch.
What you're proposing is to exactly revert https://git.buildroot.org/buildroot/commit/package/pkg-cmake.mk?id=104bb29e0490bfb487e2e665448dd3ca07fcc2b5, which already reverted the change you're proposing :) So, see the commit log of https://git.buildroot.org/buildroot/commit/package/pkg-cmake.mk?id=104bb29e0490bfb487e2e665448dd3ca07fcc2b5 for the explanation of why we're using the Debug build type and not the RelWithDebInfo build type. If you disagree, please submit a patch to the mailing list with a precise description of why reverting https://git.buildroot.org/buildroot/commit/package/pkg-cmake.mk?id=104bb29e0490bfb487e2e665448dd3ca07fcc2b5 is a good idea. Thanks!
Thanks for the pointer. The rational in the commit message your pointing to does not make sense to me, will email the mailing-list.