All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-core][PATCH 1/2] bitbake.conf: Split optimization into common part
@ 2020-11-22 12:48 Andrej Valek
  2020-11-22 12:48 ` [OE-core][PATCH 2/2] cmake: split release and debug flags Andrej Valek
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Andrej Valek @ 2020-11-22 12:48 UTC (permalink / raw)
  To: openembedded-core; +Cc: Andrej Valek, Pascal Bach, Adrian Freihofer

This option allows correctly handle the release/debug flags separation in
upper recipe like cmake.

Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/conf/bitbake.conf | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 0d38eac094..5555093e24 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -569,7 +569,7 @@ TARGET_CPPFLAGS = ""
 export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}"
 BUILDSDK_CFLAGS = "${BUILDSDK_CPPFLAGS} ${BUILD_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"
 export CFLAGS = "${TARGET_CFLAGS}"
-TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}"
+TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
 
 export BUILD_CXXFLAGS = "${BUILD_CFLAGS}"
 BUILDSDK_CXXFLAGS = "${BUILDSDK_CFLAGS}"
@@ -616,8 +616,9 @@ DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTEND
 DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
 
 # Disabled until the option works properly -feliminate-dwarf2-dups
-FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
-DEBUG_OPTIMIZATION = "-Og ${DEBUG_FLAGS} -pipe"
+COMMON_OPTIMIZATION = "${DEBUG_FLAGS} -pipe"
+FULL_OPTIMIZATION = "-O2"
+DEBUG_OPTIMIZATION = "-Og"
 SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
 SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
 BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g -feliminate-unused-debug-types', '-O2', d)} -pipe"
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [OE-core][PATCH 2/2] cmake: split release and debug flags
  2020-11-22 12:48 [OE-core][PATCH 1/2] bitbake.conf: Split optimization into common part Andrej Valek
@ 2020-11-22 12:48 ` Andrej Valek
  2020-11-23 15:03   ` Khem Raj
  2020-11-23 19:00 ` [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part Andrej Valek
  2020-11-23 19:00 ` [OE-core][PATCH v2 2/2] cmake: split release and debug flags Andrej Valek
  2 siblings, 1 reply; 15+ messages in thread
From: Andrej Valek @ 2020-11-22 12:48 UTC (permalink / raw)
  To: openembedded-core; +Cc: Andrej Valek, Pascal Bach, Adrian Freihofer

Keep only flags related to release in particular part _RELEASE (same for
debug). This option allows to really use the Release/Debug build type
in cmake. The corresponding build type will have corresponding flags set
with/without optimization. Flags are respecting selected optimization from
the whole build.

Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/classes/cmake.bbclass | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 7c055e8a3d..a0ce92ce46 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -25,15 +25,23 @@ python() {
 OECMAKE_AR ?= "${AR}"
 
 # Compiler flags
-OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
-OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS}"
-OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG"
-OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
+OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS_COMMON}"
+OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON}"
+OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
+OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
+OECMAKE_C_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
+OECMAKE_CXX_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
 OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
-OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"
+OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON} ${LDFLAGS}"
+OECMAKE_LINKER_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION}"
+OECMAKE_LINKER_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
 CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
 CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
 
+# Common CFLAGS/CXXFLAGS without optimization
+CFLAGS_COMMON = "${@d.getVar('CFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
+CXXFLAGS_COMMON = "${@d.getVar('CXXFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
+
 def oecmake_map_compiler(compiler, d):
     args = d.getVar(compiler).split()
     if args[0] == "ccache":
@@ -107,8 +115,17 @@ set( CMAKE_ASM_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "ASM FLAGS" )
 set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional CFLAGS for release" )
 set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for release" )
 set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional ASM FLAGS for release" )
+set( CMAKE_C_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING "Additional CFLAGS for debug" )
+set( CMAKE_CXX_FLAGS_DEBUG "${OECMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Additional CXXFLAGS for debug" )
+set( CMAKE_ASM_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING "Additional ASM FLAGS for debug" )
 set( CMAKE_C_LINK_FLAGS "${OECMAKE_C_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
 set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
+set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional SHARED LINKER FLAGS for release" )
+set( CMAKE_SHARED_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional SHARED LINKER FLAGS for debug" )
+set( CMAKE_MODULE_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional MODULE LINKER FLAGS for release" )
+set( CMAKE_MODULE_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional MODULE LINKER FLAGS for debug" )
+set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional EXE LINKER FLAGS for release" )
+set( CMAKE_EXE_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional EXE LINKER FLAGS for debug" )
 
 # only search in the paths provided so cmake doesnt pick
 # up libraries and tools from the native build machine
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH 2/2] cmake: split release and debug flags
  2020-11-22 12:48 ` [OE-core][PATCH 2/2] cmake: split release and debug flags Andrej Valek
@ 2020-11-23 15:03   ` Khem Raj
  0 siblings, 0 replies; 15+ messages in thread
From: Khem Raj @ 2020-11-23 15:03 UTC (permalink / raw)
  To: Andrej Valek; +Cc: openembedded-core, Pascal Bach, Adrian Freihofer

I am seeing several failures due to this series see

https://errors.yoctoproject.org/Errors/Build/113114/

On Sun, Nov 22, 2020 at 4:49 AM Andrej Valek <andrej.valek@siemens.com> wrote:
>
> Keep only flags related to release in particular part _RELEASE (same for
> debug). This option allows to really use the Release/Debug build type
> in cmake. The corresponding build type will have corresponding flags set
> with/without optimization. Flags are respecting selected optimization from
> the whole build.
>
> Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>  meta/classes/cmake.bbclass | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index 7c055e8a3d..a0ce92ce46 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -25,15 +25,23 @@ python() {
>  OECMAKE_AR ?= "${AR}"
>
>  # Compiler flags
> -OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
> -OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS}"
> -OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG"
> -OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
> +OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS_COMMON}"
> +OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON}"
> +OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
> +OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} -DNDEBUG"
> +OECMAKE_C_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
> +OECMAKE_CXX_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
>  OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
> -OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"
> +OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON} ${LDFLAGS}"
> +OECMAKE_LINKER_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION}"
> +OECMAKE_LINKER_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
>  CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
>  CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
>
> +# Common CFLAGS/CXXFLAGS without optimization
> +CFLAGS_COMMON = "${@d.getVar('CFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
> +CXXFLAGS_COMMON = "${@d.getVar('CXXFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
> +
>  def oecmake_map_compiler(compiler, d):
>      args = d.getVar(compiler).split()
>      if args[0] == "ccache":
> @@ -107,8 +115,17 @@ set( CMAKE_ASM_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "ASM FLAGS" )
>  set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional CFLAGS for release" )
>  set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for release" )
>  set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional ASM FLAGS for release" )
> +set( CMAKE_C_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING "Additional CFLAGS for debug" )
> +set( CMAKE_CXX_FLAGS_DEBUG "${OECMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Additional CXXFLAGS for debug" )
> +set( CMAKE_ASM_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING "Additional ASM FLAGS for debug" )
>  set( CMAKE_C_LINK_FLAGS "${OECMAKE_C_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
>  set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
> +set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional SHARED LINKER FLAGS for release" )
> +set( CMAKE_SHARED_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional SHARED LINKER FLAGS for debug" )
> +set( CMAKE_MODULE_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional MODULE LINKER FLAGS for release" )
> +set( CMAKE_MODULE_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional MODULE LINKER FLAGS for debug" )
> +set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional EXE LINKER FLAGS for release" )
> +set( CMAKE_EXE_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional EXE LINKER FLAGS for debug" )
>
>  # only search in the paths provided so cmake doesnt pick
>  # up libraries and tools from the native build machine
> --
> 2.11.0
>
>
> 
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part
  2020-11-22 12:48 [OE-core][PATCH 1/2] bitbake.conf: Split optimization into common part Andrej Valek
  2020-11-22 12:48 ` [OE-core][PATCH 2/2] cmake: split release and debug flags Andrej Valek
@ 2020-11-23 19:00 ` Andrej Valek
  2020-11-23 19:17   ` Richard Purdie
                     ` (2 more replies)
  2020-11-23 19:00 ` [OE-core][PATCH v2 2/2] cmake: split release and debug flags Andrej Valek
  2 siblings, 3 replies; 15+ messages in thread
From: Andrej Valek @ 2020-11-23 19:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: Andrej Valek, Pascal Bach, Adrian Freihofer

This option allows correctly handle the release/debug flags separation in
upper recipe like cmake. Adopt SELECTED_OPTIMIZATION usage in other
recipes.

Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/conf/bitbake.conf                            | 7 ++++---
 meta/conf/distro/include/security_flags.inc       | 8 ++++----
 meta/conf/local.conf.sample.extended              | 1 +
 meta/recipes-devtools/valgrind/valgrind_3.16.1.bb | 1 +
 4 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 0d38eac094..5555093e24 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -569,7 +569,7 @@ TARGET_CPPFLAGS = ""
 export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}"
 BUILDSDK_CFLAGS = "${BUILDSDK_CPPFLAGS} ${BUILD_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"
 export CFLAGS = "${TARGET_CFLAGS}"
-TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}"
+TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
 
 export BUILD_CXXFLAGS = "${BUILD_CFLAGS}"
 BUILDSDK_CXXFLAGS = "${BUILDSDK_CFLAGS}"
@@ -616,8 +616,9 @@ DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTEND
 DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
 
 # Disabled until the option works properly -feliminate-dwarf2-dups
-FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
-DEBUG_OPTIMIZATION = "-Og ${DEBUG_FLAGS} -pipe"
+COMMON_OPTIMIZATION = "${DEBUG_FLAGS} -pipe"
+FULL_OPTIMIZATION = "-O2"
+DEBUG_OPTIMIZATION = "-Og"
 SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
 SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
 BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g -feliminate-unused-debug-types', '-O2', d)} -pipe"
diff --git a/meta/conf/distro/include/security_flags.inc b/meta/conf/distro/include/security_flags.inc
index 4e64eb99f9..60370eeb17 100644
--- a/meta/conf/distro/include/security_flags.inc
+++ b/meta/conf/distro/include/security_flags.inc
@@ -63,7 +63,7 @@ SECURITY_STACK_PROTECTOR_pn-glibc-testsuite = ""
 # handled in recipes-graphics/xorg-driver/xorg-driver-common.inc
 SECURITY_LDFLAGS_pn-xserver-xorg = "${SECURITY_X_LDFLAGS}"
 
-TARGET_CC_ARCH_append_pn-binutils = " ${SELECTED_OPTIMIZATION}"
-TARGET_CC_ARCH_append_pn-gcc = " ${SELECTED_OPTIMIZATION}"
-TARGET_CC_ARCH_append_pn-gdb = " ${SELECTED_OPTIMIZATION}"
-TARGET_CC_ARCH_append_pn-perf = " ${SELECTED_OPTIMIZATION}"
+TARGET_CC_ARCH_append_pn-binutils = " ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
+TARGET_CC_ARCH_append_pn-gcc = " ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
+TARGET_CC_ARCH_append_pn-gdb = " ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
+TARGET_CC_ARCH_append_pn-perf = " ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
diff --git a/meta/conf/local.conf.sample.extended b/meta/conf/local.conf.sample.extended
index 5ece522fa8..51cea43b9e 100644
--- a/meta/conf/local.conf.sample.extended
+++ b/meta/conf/local.conf.sample.extended
@@ -99,6 +99,7 @@
 #
 # PROFILE_OPTIMIZATION = "-pg"
 # SELECTED_OPTIMIZATION = "${PROFILE_OPTIMIZATION}"
+# COMMON_OPTIMIZATION = ""
 # LDFLAGS =+ "-pg"
 
 # TCMODE controls the characteristics of the generated packages/images by
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
index bcba55f327..395d603cec 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
@@ -97,6 +97,7 @@ CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
 # (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it
 # which fixes build path issue in DWARF.
 SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}"
+COMMON_OPTIMIZATION = ""
 
 do_configure_prepend () {
     rm -rf ${S}/config.h
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [OE-core][PATCH v2 2/2] cmake: split release and debug flags
  2020-11-22 12:48 [OE-core][PATCH 1/2] bitbake.conf: Split optimization into common part Andrej Valek
  2020-11-22 12:48 ` [OE-core][PATCH 2/2] cmake: split release and debug flags Andrej Valek
  2020-11-23 19:00 ` [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part Andrej Valek
@ 2020-11-23 19:00 ` Andrej Valek
  2020-11-24 19:32   ` Khem Raj
  2 siblings, 1 reply; 15+ messages in thread
From: Andrej Valek @ 2020-11-23 19:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: Andrej Valek, Pascal Bach, Adrian Freihofer

Keep only flags related to release in particular part _RELEASE (same for
debug). This option allows to really use the Release/Debug build type
in cmake. The corresponding build type will have corresponding flags set
with/without optimization. Flags are respecting selected optimization from
the whole build.

Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/classes/cmake.bbclass | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index 7c055e8a3d..1305b40bf9 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -25,14 +25,25 @@ python() {
 OECMAKE_AR ?= "${AR}"
 
 # Compiler flags
-OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
-OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS}"
-OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG"
-OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
-OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
-OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"
-CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
-CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
+OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CFLAGS_COMMON}"
+OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON}"
+OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify} -DNDEBUG"
+OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify} -DNDEBUG"
+OECMAKE_C_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
+OECMAKE_CXX_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
+OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
+OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON} ${LDFLAGS}"
+OECMAKE_LINKER_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify}"
+OECMAKE_LINKER_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
+CXXFLAGS += "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS}"
+CFLAGS += "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS}"
+
+# Common compiler flags
+# CFLAGS/CXXFLAGS without optimization
+# HOST_CC_ARCH without fortify
+CFLAGS_COMMON = "${@d.getVar('CFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
+CXXFLAGS_COMMON = "${@d.getVar('CXXFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
+HOST_CC_ARCH_COMMON = "${@d.getVar('HOST_CC_ARCH').replace(d.getVar('lcl_maybe_fortify'),'')}"
 
 def oecmake_map_compiler(compiler, d):
     args = d.getVar(compiler).split()
@@ -107,8 +118,17 @@ set( CMAKE_ASM_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "ASM FLAGS" )
 set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional CFLAGS for release" )
 set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for release" )
 set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional ASM FLAGS for release" )
+set( CMAKE_C_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING "Additional CFLAGS for debug" )
+set( CMAKE_CXX_FLAGS_DEBUG "${OECMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Additional CXXFLAGS for debug" )
+set( CMAKE_ASM_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING "Additional ASM FLAGS for debug" )
 set( CMAKE_C_LINK_FLAGS "${OECMAKE_C_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
 set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
+set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional SHARED LINKER FLAGS for release" )
+set( CMAKE_SHARED_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional SHARED LINKER FLAGS for debug" )
+set( CMAKE_MODULE_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional MODULE LINKER FLAGS for release" )
+set( CMAKE_MODULE_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional MODULE LINKER FLAGS for debug" )
+set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional EXE LINKER FLAGS for release" )
+set( CMAKE_EXE_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional EXE LINKER FLAGS for debug" )
 
 # only search in the paths provided so cmake doesnt pick
 # up libraries and tools from the native build machine
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part
  2020-11-23 19:00 ` [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part Andrej Valek
@ 2020-11-23 19:17   ` Richard Purdie
  2020-11-24  8:01     ` Andrej Valek
  2020-11-24 19:29   ` Khem Raj
  2020-11-25 10:30   ` Richard Purdie
  2 siblings, 1 reply; 15+ messages in thread
From: Richard Purdie @ 2020-11-23 19:17 UTC (permalink / raw)
  To: Andrej Valek, openembedded-core; +Cc: Pascal Bach, Adrian Freihofer

On Mon, 2020-11-23 at 20:00 +0100, Andrej Valek wrote:
> This option allows correctly handle the release/debug flags
> separation in
> upper recipe like cmake. Adopt SELECTED_OPTIMIZATION usage in other
> recipes.
> 
> Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>  meta/conf/bitbake.conf                            | 7 ++++---
>  meta/conf/distro/include/security_flags.inc       | 8 ++++----
>  meta/conf/local.conf.sample.extended              | 1 +
>  meta/recipes-devtools/valgrind/valgrind_3.16.1.bb | 1 +
>  4 files changed, 10 insertions(+), 7 deletions(-)

This, or the cmake change that follows seemed to cause:

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/2738
https://autobuilder.yoctoproject.org/typhoon/#/builders/52/builds/2718
https://autobuilder.yoctoproject.org/typhoon/#/builders/108/builds/1129

and maybe

https://autobuilder.yoctoproject.org/typhoon/#/builders/100/builds/956

Cheers,

Richard


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part
  2020-11-23 19:17   ` Richard Purdie
@ 2020-11-24  8:01     ` Andrej Valek
  2020-11-24 13:34       ` Richard Purdie
  0 siblings, 1 reply; 15+ messages in thread
From: Andrej Valek @ 2020-11-24  8:01 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core; +Cc: Bach, Pascal, Freihofer, Adrian

Hello Richard,

Is it possible to provide log.do_configure log? I've tried it on qemux86-64 and it works without problems. Tests were based on poky-glibc-x86_64-core-image-sato-core2-64-qemux86-64-toolchain-ext-3.2.sh .

DEBUG: Python function extend_recipe_sysroot finished
DEBUG: Executing shell function do_configure
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
...
-- Build files have been written to: /home/projects/yocto/qemux86-64/tmp/work/core2-64-poky-linux/cmake/3.18.2-r0/build
DEBUG: Shell function do_configure finished
DEBUG: Executing python function do_qa_configure
DEBUG: Python function do_qa_configure finished

Regards,
Andrej

> On Mon, 2020-11-23 at 20:00 +0100, Andrej Valek wrote:
>> This option allows correctly handle the release/debug flags separation 
>> in upper recipe like cmake. Adopt SELECTED_OPTIMIZATION usage in other 
>> recipes.
>> 
>> Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
>> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
>> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
>> ---
>>  meta/conf/bitbake.conf                            | 7 ++++---
>>  meta/conf/distro/include/security_flags.inc       | 8 ++++----
>>  meta/conf/local.conf.sample.extended              | 1 +
>>  meta/recipes-devtools/valgrind/valgrind_3.16.1.bb | 1 +
>>  4 files changed, 10 insertions(+), 7 deletions(-)
>
> This, or the cmake change that follows seemed to cause:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/2738
> https://autobuilder.yoctoproject.org/typhoon/#/builders/52/builds/2718
> https://autobuilder.yoctoproject.org/typhoon/#/builders/108/builds/1129
>
> and maybe
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/100/builds/956
>
> Cheers,
>
> Richard

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part
  2020-11-24  8:01     ` Andrej Valek
@ 2020-11-24 13:34       ` Richard Purdie
  2020-11-24 18:47         ` Andrej Valek
  0 siblings, 1 reply; 15+ messages in thread
From: Richard Purdie @ 2020-11-24 13:34 UTC (permalink / raw)
  To: Valek, Andrej, openembedded-core; +Cc: Bach, Pascal, Freihofer, Adrian

On Tue, 2020-11-24 at 08:01 +0000, Valek, Andrej wrote:
> Hello Richard,
> 
> Is it possible to provide log.do_configure log? I've tried it on
> qemux86-64 and it works without problems. Tests were based on poky-
> glibc-x86_64-core-image-sato-core2-64-qemux86-64-toolchain-ext-3.2.sh 
> .
> 
> DEBUG: Python function extend_recipe_sysroot finished
> DEBUG: Executing shell function do_configure
> -- The C compiler identification is GNU 10.2.0
> -- The CXX compiler identification is GNU 10.2.0
> ...
> -- Build files have been written to: /home/projects/yocto/qemux86-
> 64/tmp/work/core2-64-poky-linux/cmake/3.18.2-r0/build
> DEBUG: Shell function do_configure finished
> DEBUG: Executing python function do_qa_configure
> DEBUG: Python function do_qa_configure finished

You can see that on the autobuilder here:

https://autobuilder.yoctoproject.org/typhoon/#/builders/52/builds/2718/steps/12/logs/stdio

i.e.:

ERROR: cmake-3.18.4-r0 do_configure: Execution of '/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/temp/run.do_configure.25583' failed with exit code 1:
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking if compiler supports C11 _Thread_local
-- Checking if compiler supports C11 _Thread_local - yes
-- Checking if compiler supports needed C++17 constructs
-- Checking if compiler supports needed C++17 constructs - yes
-- Checking if compiler supports C++ make_unique
-- Checking if compiler supports C++ make_unique - no
-- Checking if compiler supports C++ unique_ptr
-- Checking if compiler supports C++ unique_ptr - no
CMake Error at CMakeLists.txt:107 (message):
  The C++ compiler does not support C++11 (e.g.  std::unique_ptr).
-- Configuring incomplete, errors occurred!
See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeOutput.log".
See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeError.log".
WARNING: exit code 1 from a shell command.
NOTE: recipe lib32-epiphany-3.38.1-r0: task do_configure: Succeeded
NOTE: Running task 15280 of 24981 (virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-graphics/xorg-util/makedepend_1.0.6.bb:do_configure)
NOTE: recipe lib32-makedepend-1_1.0.6-r0: task do_configure: Started
ERROR: Logfile of failure stored in: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/temp/log.do_configure.25583
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-core/expat/expat_2.2.10.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-extended/bzip2/bzip2_1.0.8.bb:do_populate_sysroot', 'virtual:native:/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-extended/xz/xz_5.2.5.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-core/ncurses/ncurses_6.2.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtools/gcc/gcc-cross_10.2.bb:do_populate_sysroot', 'virtual:native:/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-extended/libarchive/libarchive_3.4.3.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-core/glibc/glibc_2.32.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtools/gcc/gcc-runtime_10.2.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtools/quilt/quilt-native_0.66.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-support/bash-completion/bash-completion_2.11.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-core/zlib/zlib_1.2.11.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-support/curl/curl_7.73.0.bb:do_populate_sysroot', '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtools/cmake/cmake-native_3.18.4.bb:do_populate_sysroot', 'virtual:native:/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtools/ninja/ninja_1.10.1.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['expat', 'bzip2', 'patch-native', 'xz', 'ncurses', 'gcc-cross-x86_64', 'pseudo-native', 'libarchive', 'glibc', 'gcc-runtime', 'quilt-native', 'bash-completion', 'zlib', 'curl', 'cmake-native', 'ninja-native', 'opkg-utils', 'libtool-native', 'attr-native', 'automake-native', 'gnu-config-native', 'autoconf-native', 'gmp-native', 'mpfr-native', 'texinfo-dummy-native', 'zlib-native', 'libmpc-native', 'binutils-cross-x86_64', 'linux-libc-headers', 'xz-native', 'flex-native', 'libxml2', 'acl', 'lzo', 'attr', 'libgcc', 'gnutls', 'libidn2', 'bzip2-native', 'curl-native', 'ncurses-native', 're2c-native', 'gettext-minimal-native', 'm4-native', 'python3', 'nettle', 'libunistring', 'gmp', 'pkgconfig-native', 'openssl-native', 'gdbm', 'libxcrypt', 'openssl', 'sqlite3', 'libffi', 'libtirpc', 'libnsl2', 'readline', 'util-linux', 'libcap-ng']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_configure
| -- The C compiler identification is GNU 10.2.0
| -- The CXX compiler identification is GNU 10.2.0
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Check for working C compiler: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc - skipped
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Detecting CXX compiler ABI info
| -- Detecting CXX compiler ABI info - done
| -- Check for working CXX compiler: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-g++ - skipped
| -- Detecting CXX compile features
| -- Detecting CXX compile features - done
| -- Checking if compiler supports C11 _Thread_local
| -- Checking if compiler supports C11 _Thread_local - yes
| -- Checking if compiler supports needed C++17 constructs
| -- Checking if compiler supports needed C++17 constructs - yes
| -- Checking if compiler supports C++ make_unique
| -- Checking if compiler supports C++ make_unique - no
| -- Checking if compiler supports C++ unique_ptr
| -- Checking if compiler supports C++ unique_ptr - no
| CMake Error at CMakeLists.txt:107 (message):
|   The C++ compiler does not support C++11 (e.g.  std::unique_ptr).
| 
| 
| -- Configuring incomplete, errors occurred!
| See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeOutput.log".
| See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeError.log".
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/temp/run.do_configure.25583' failed with exit code 1:
| -- The C compiler identification is GNU 10.2.0
| -- The CXX compiler identification is GNU 10.2.0
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Check for working C compiler: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc - skipped
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Detecting CXX compiler ABI info
| -- Detecting CXX compiler ABI info - done
| -- Check for working CXX compiler: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-g++ - skipped
| -- Detecting CXX compile features
| -- Detecting CXX compile features - done
| -- Checking if compiler supports C11 _Thread_local
| -- Checking if compiler supports C11 _Thread_local - yes
| -- Checking if compiler supports needed C++17 constructs
| -- Checking if compiler supports needed C++17 constructs - yes
| -- Checking if compiler supports C++ make_unique
| -- Checking if compiler supports C++ make_unique - no
| -- Checking if compiler supports C++ unique_ptr
| -- Checking if compiler supports C++ unique_ptr - no
| CMake Error at CMakeLists.txt:107 (message):
|   The C++ compiler does not support C++11 (e.g.  std::unique_ptr).
| 
| 
| -- Configuring incomplete, errors occurred!
| See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeOutput.log".
| See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeError.log".
| WARNING: exit code 1 from a shell command.
| 
NOTE: recipe cmake-3.18.4-r0: task do_configure: Failed
ERROR: Task (/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtools/cmake/cmake_3.18.4.bb:do_configure) failed with exit code '1'

however this should give a better hint:

pokybuild@debian8-ty-1:~/yocto-worker/qemux86-world/build/build-renamed/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles$ cat CMakeError.log 
Determining if compiler supports C++ make_unique failed with the following output:
Change Dir: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeTmp

Run Build Command(s):ninja cmTC_6b525 && [1/2] Building CXX object CMakeFiles/cmTC_6b525.dir/cm_cxx_make_unique.cxx.o
In file included from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/x86_64-poky-linux/bits/os_defines.h:39,
                 from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/x86_64-poky-linux/bits/c++config.h:518,
                 from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/bits/stl_algobase.h:59,
                 from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/memory:63,
                 from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/cmake-3.18.4/Source/Checks/cm_cxx_make_unique.cxx:1:
/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
  397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
[2/2] Linking CXX executable cmTC_6b525



Determining if compiler supports C++ unique_ptr failed with the following output:
Change Dir: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeTmp

Run Build Command(s):ninja cmTC_24b5e && [1/2] Building CXX object CMakeFiles/cmTC_24b5e.dir/cm_cxx_unique_ptr.cxx.o
In file included from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/x86_64-poky-linux/bits/os_defines.h:39,
                 from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/x86_64-poky-linux/bits/c++config.h:518,
                 from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/bits/stl_algobase.h:59,
                 from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/memory:63,
                 from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/cmake-3.18.4/Source/Checks/cm_cxx_unique_ptr.cxx:1:
/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
  397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
      |    ^~~~~~~
[2/2] Linking CXX executable cmTC_24b5e


which suggests its the security flags inclusion. Did you modify the
distro? or are you not using poky?

Cheers,

Richard


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part
  2020-11-24 13:34       ` Richard Purdie
@ 2020-11-24 18:47         ` Andrej Valek
  0 siblings, 0 replies; 15+ messages in thread
From: Andrej Valek @ 2020-11-24 18:47 UTC (permalink / raw)
  To: Richard Purdie, openembedded-core; +Cc: Bach, Pascal, Freihofer, Adrian

Hello again,

No I didn't modify the distro, I'm using the poky without modifications including security flags.
Now I made double check with this configuration from scratch.

git clone https://git.yoctoproject.org/git/poky
cd poky
// applied my cmake changes
export MACHINE=qemux86-64
. oe-init-build-env
bitbake cmake -c configure

Loading cache: 100% |                                        | ETA:  --:--:--
Loaded 0 entries from dependency cache.
Parsing recipes: 100% |#######################################| Time: 0:00:28
Parsing of 790 .bb files complete (0 cached, 790 parsed). 1369 targets, 42 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.49.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "debian-9"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.2+snapshot-20201124"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "master:3ecf5d9692fec97b37af6a4e6c747a4e2c2ca292"

NOTE: Fetching uninative binary shim http://downloads.yoctoproject.org/releases/uninative/2.9/x86_64-nativesdk-libc.tar.xz;sha256sum=d07916b95c419c81541a19c8ef0ed8cbd78ae18437ff28a4c8a60ef40518e423 (will check PREMIRRORS first)
Initialising tasks: 100% |####################################| Time: 0:00:01
Sstate summary: Wanted 173 Found 0 Missed 173 Current 0 (0% match, 0% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 811 tasks of which 0 didn't need to be rerun and all succeeded.

So everything passed as well.

Yes, I think, there is probably a problem with mixed options from security flags.

Is it possible to somehow provide the output toolchain.cmake file, to really see the rootcouse?

Regards,
Andrej

>> Hello Richard,
>>
>> Is it possible to provide log.do_configure log? I've tried it on
>> qemux86-64 and it works without problems. Tests were based on poky-
>> glibc-x86_64-core-image-sato-core2-64-qemux86-64-toolchain-ext-3.2.sh
>> .
>>
>> DEBUG: Python function extend_recipe_sysroot finished
>> DEBUG: Executing shell function do_configure
>> -- The C compiler identification is GNU 10.2.0
>> -- The CXX compiler identification is GNU 10.2.0 ...
>> -- Build files have been written to: /home/projects/yocto/qemux86-
>> 64/tmp/work/core2-64-poky-linux/cmake/3.18.2-r0/build
>> DEBUG: Shell function do_configure finished
>> DEBUG: Executing python function do_qa_configure
>> DEBUG: Python function do_qa_configure finished
>
> You can see that on the autobuilder here:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/52/builds/2718/steps/12/logs/stdio
>
> i.e.:
>
> ERROR: cmake-3.18.4-r0 do_configure: Execution of '/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/temp/run.do_configure.25583' failed with exit code 1:
> -- The C compiler identification is GNU 10.2.0
> -- The CXX compiler identification is GNU 10.2.0
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working C compiler: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc - skipped
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Check for working CXX compiler: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-g++ - skipped
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- Checking if compiler supports C11 _Thread_local
> -- Checking if compiler supports C11 _Thread_local - yes
> -- Checking if compiler supports needed C++17 constructs
> -- Checking if compiler supports needed C++17 constructs - yes
> -- Checking if compiler supports C++ make_unique
> -- Checking if compiler supports C++ make_unique - no
> -- Checking if compiler supports C++ unique_ptr
> -- Checking if compiler supports C++ unique_ptr - no CMake Error at CMakeLists.txt:107 (message):
  > The C++ compiler does not support C++11 (e.g.  std::unique_ptr).
> -- Configuring incomplete, errors occurred!
> See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeOutput.log".
> See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeError.log".
> WARNING: exit code 1 from a shell command.
> NOTE: recipe lib32-epiphany-3.38.1-r0: task do_configure: Succeeded
> NOTE: Running task 15280 of 24981 (virtual:multilib:lib32:/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-graphics/xorg-util/makedepend_1.0.6.bb:do_configure)
> NOTE: recipe lib32-makedepend-1_1.0.6-r0: task do_configure: Started
> ERROR: Logfile of failure stored in: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/temp/log.do_configure.25583
> Log data follows:
> | DEBUG: Executing python function extend_recipe_sysroot
> | NOTE: Direct dependencies are
> | ['/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-core/e
> | xpat/expat_2.2.10.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-extende
> | d/bzip2/bzip2_1.0.8.bb:do_populate_sysroot',
> | 'virtual:native:/home/pokybuild/yocto-worker/qemux86-world/build/meta/
> | recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-extende
> | d/xz/xz_5.2.5.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-core/nc
> | urses/ncurses_6.2.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtool
> | s/gcc/gcc-cross_10.2.bb:do_populate_sysroot',
> | 'virtual:native:/home/pokybuild/yocto-worker/qemux86-world/build/meta/
> | recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-extende
> | d/libarchive/libarchive_3.4.3.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-core/gl
> | ibc/glibc_2.32.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtool
> | s/gcc/gcc-runtime_10.2.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtool
> | s/quilt/quilt-native_0.66.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-support
> | /bash-completion/bash-completion_2.11.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-core/zl
> | ib/zlib_1.2.11.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-support
> | /curl/curl_7.73.0.bb:do_populate_sysroot',
> | '/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtool
> | s/cmake/cmake-native_3.18.4.bb:do_populate_sysroot',
> | 'virtual:native:/home/pokybuild/yocto-worker/qemux86-world/build/meta/
> | recipes-devtools/ninja/ninja_1.10.1.bb:do_populate_sysroot']
> | NOTE: Installed into sysroot: []
> | NOTE: Skipping as already exists in sysroot: ['expat', 'bzip2',
> | 'patch-native', 'xz', 'ncurses', 'gcc-cross-x86_64', 'pseudo-native',
> | 'libarchive', 'glibc', 'gcc-runtime', 'quilt-native',
> | 'bash-completion', 'zlib', 'curl', 'cmake-native', 'ninja-native',
> | 'opkg-utils', 'libtool-native', 'attr-native', 'automake-native',
> | 'gnu-config-native', 'autoconf-native', 'gmp-native', 'mpfr-native',
> | 'texinfo-dummy-native', 'zlib-native', 'libmpc-native',
> | 'binutils-cross-x86_64', 'linux-libc-headers', 'xz-native',
> | 'flex-native', 'libxml2', 'acl', 'lzo', 'attr', 'libgcc', 'gnutls',
> | 'libidn2', 'bzip2-native', 'curl-native', 'ncurses-native',
> | 're2c-native', 'gettext-minimal-native', 'm4-native', 'python3',
> | 'nettle', 'libunistring', 'gmp', 'pkgconfig-native', 'openssl-native',
> | 'gdbm', 'libxcrypt', 'openssl', 'sqlite3', 'libffi', 'libtirpc',
> | 'libnsl2', 'readline', 'util-linux', 'libcap-ng']
> | DEBUG: Python function extend_recipe_sysroot finished
> | DEBUG: Executing shell function do_configure
> | -- The C compiler identification is GNU 10.2.0
> | -- The CXX compiler identification is GNU 10.2.0
> | -- Detecting C compiler ABI info
> | -- Detecting C compiler ABI info - done
> | -- Check for working C compiler:
> | /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-
> | 64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-pok
> | y-linux/x86_64-poky-linux-gcc - skipped
> | -- Detecting C compile features
> | -- Detecting C compile features - done
> | -- Detecting CXX compiler ABI info
> | -- Detecting CXX compiler ABI info - done
> | -- Check for working CXX compiler:
> | /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-
> | 64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-pok
> | y-linux/x86_64-poky-linux-g++ - skipped
> | -- Detecting CXX compile features
> | -- Detecting CXX compile features - done
> | -- Checking if compiler supports C11 _Thread_local
> | -- Checking if compiler supports C11 _Thread_local - yes
> | -- Checking if compiler supports needed C++17 constructs
> | -- Checking if compiler supports needed C++17 constructs - yes
> | -- Checking if compiler supports C++ make_unique
> | -- Checking if compiler supports C++ make_unique - no
> | -- Checking if compiler supports C++ unique_ptr
> | -- Checking if compiler supports C++ unique_ptr - no CMake Error at
> | CMakeLists.txt:107 (message):
> |   The C++ compiler does not support C++11 (e.g.  std::unique_ptr).
> |
> |
> | -- Configuring incomplete, errors occurred!
> | See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeOutput.log".
> | See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeError.log".
> | WARNING: exit code 1 from a shell command.
> | ERROR: Execution of '/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/temp/run.do_configure.25583' failed with exit code 1:
> | -- The C compiler identification is GNU 10.2.0
> | -- The CXX compiler identification is GNU 10.2.0
> | -- Detecting C compiler ABI info
> | -- Detecting C compiler ABI info - done
> | -- Check for working C compiler:
> | /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-
> | 64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-pok
> | y-linux/x86_64-poky-linux-gcc - skipped
> | -- Detecting C compile features
> | -- Detecting C compile features - done
> | -- Detecting CXX compiler ABI info
> | -- Detecting CXX compiler ABI info - done
> | -- Check for working CXX compiler:
> | /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-
> | 64-poky-linux/cmake/3.18.4-r0/recipe-sysroot-native/usr/bin/x86_64-pok
> | y-linux/x86_64-poky-linux-g++ - skipped
> | -- Detecting CXX compile features
> | -- Detecting CXX compile features - done
> | -- Checking if compiler supports C11 _Thread_local
> | -- Checking if compiler supports C11 _Thread_local - yes
> | -- Checking if compiler supports needed C++17 constructs
> | -- Checking if compiler supports needed C++17 constructs - yes
> | -- Checking if compiler supports C++ make_unique
> | -- Checking if compiler supports C++ make_unique - no
> | -- Checking if compiler supports C++ unique_ptr
> | -- Checking if compiler supports C++ unique_ptr - no CMake Error at
> | CMakeLists.txt:107 (message):
> |   The C++ compiler does not support C++11 (e.g.  std::unique_ptr).
> |
> |
> | -- Configuring incomplete, errors occurred!
> | See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeOutput.log".
> | See also "/home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeError.log".
> | WARNING: exit code 1 from a shell command.
> |
> NOTE: recipe cmake-3.18.4-r0: task do_configure: Failed
> ERROR: Task (/home/pokybuild/yocto-worker/qemux86-world/build/meta/recipes-devtools/cmake/cmake_3.18.4.bb:do_configure) failed with exit code '1'
>
> however this should give a better hint:
>
> pokybuild@debian8-ty-1:~/yocto-worker/qemux86-world/build/build-renamed/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles$ cat CMakeError.log Determining if compiler supports C++ make_unique failed with the following output:
> Change Dir: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeTmp
>
> Run Build Command(s):ninja cmTC_6b525 && [1/2] Building CXX object CMakeFiles/cmTC_6b525.dir/cm_cxx_make_unique.cxx.o
> In file included from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/x86_64-poky-linux/bits/os_defines.h:39,
>                  from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/x86_64-poky-linux/bits/c++config.h:518,
>                  from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/bits/stl_algobase.h:59,
>                  from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/memory:63,
>                  from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/cmake-3.18.4/Source/Checks/cm_cxx_make_unique.cxx:1:
> /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
> 397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>     |    ^~~~~~~
> [2/2] Linking CXX executable cmTC_6b525
>
>
>
> Determining if compiler supports C++ unique_ptr failed with the following output:
> Change Dir: /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/build/CMakeFiles/CMakeTmp
>
> Run Build Command(s):ninja cmTC_24b5e && [1/2] Building CXX object CMakeFiles/cmTC_24b5e.dir/cm_cxx_unique_ptr.cxx.o
> In file included from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/x86_64-poky-linux/bits/os_defines.h:39,
>                  from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/x86_64-poky-linux/bits/c++config.h:518,
>                  from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/bits/stl_algobase.h:59,
>                  from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/c++/10.2.0/memory:63,
>                  from /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/cmake-3.18.4/Source/Checks/cm_cxx_unique_ptr.cxx:1:
> /home/pokybuild/yocto-worker/qemux86-world/build/build/tmp/work/core2-64-poky-linux/cmake/3.18.4-r0/recipe-sysroot/usr/include/features.h:397:4: warning: #warning _FORTIFY_SOURCE requires compiling with optimization (-O) [-Wcpp]
> 397 | #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
>     |    ^~~~~~~
> [2/2] Linking CXX executable cmTC_24b5e
>
>
> which suggests its the security flags inclusion. Did you modify the distro? or are you not using poky?
>
> Cheers,
>
> Richard

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part
  2020-11-23 19:00 ` [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part Andrej Valek
  2020-11-23 19:17   ` Richard Purdie
@ 2020-11-24 19:29   ` Khem Raj
  2020-11-25 10:30   ` Richard Purdie
  2 siblings, 0 replies; 15+ messages in thread
From: Khem Raj @ 2020-11-24 19:29 UTC (permalink / raw)
  To: Andrej Valek
  Cc: Patches and discussions about the oe-core layer, Pascal Bach,
	Adrian Freihofer

On Mon, Nov 23, 2020 at 11:04 AM Andrej Valek <andrej.valek@siemens.com> wrote:
>
> This option allows correctly handle the release/debug flags separation in
> upper recipe like cmake. Adopt SELECTED_OPTIMIZATION usage in other
> recipes.
>
> Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>  meta/conf/bitbake.conf                            | 7 ++++---
>  meta/conf/distro/include/security_flags.inc       | 8 ++++----
>  meta/conf/local.conf.sample.extended              | 1 +
>  meta/recipes-devtools/valgrind/valgrind_3.16.1.bb | 1 +
>  4 files changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 0d38eac094..5555093e24 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -569,7 +569,7 @@ TARGET_CPPFLAGS = ""
>  export BUILD_CFLAGS = "${BUILD_CPPFLAGS} ${BUILD_OPTIMIZATION}"
>  BUILDSDK_CFLAGS = "${BUILDSDK_CPPFLAGS} ${BUILD_OPTIMIZATION} ${DEBUG_PREFIX_MAP}"
>  export CFLAGS = "${TARGET_CFLAGS}"
> -TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}"
> +TARGET_CFLAGS = "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
>
>  export BUILD_CXXFLAGS = "${BUILD_CFLAGS}"
>  BUILDSDK_CXXFLAGS = "${BUILDSDK_CFLAGS}"
> @@ -616,8 +616,9 @@ DEBUG_PREFIX_MAP ?= "-fmacro-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTEND
>  DEBUG_FLAGS ?= "-g -feliminate-unused-debug-types ${DEBUG_PREFIX_MAP}"
>
>  # Disabled until the option works properly -feliminate-dwarf2-dups
> -FULL_OPTIMIZATION = "-O2 -pipe ${DEBUG_FLAGS}"
> -DEBUG_OPTIMIZATION = "-Og ${DEBUG_FLAGS} -pipe"
> +COMMON_OPTIMIZATION = "${DEBUG_FLAGS} -pipe"
> +FULL_OPTIMIZATION = "-O2"
> +DEBUG_OPTIMIZATION = "-Og"
>  SELECTED_OPTIMIZATION = "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"

SELECTED_OPTIMIZATION is a kind of final sum of flags that is seen by
recipes, there are more distro policies that append to it e.g.
security_flags
lto, etc and recipe space also relies on it for deducing option logic.
here we are moving some options, -pipe ${DEBUG_FLAGS} out into another
variable
COMMON_OPTIMIZATION but we do not add it back as it is but it seems
after this patch we will have two variables to look out for
SELECTED_OPTIMIZATION and COMMON_OPTIMIZATION which complicates
things. I would rather expect to make it simpler. Where there is one
final global flag set which becomes distro
policy.

>  SELECTED_OPTIMIZATION[vardeps] += "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
>  BUILD_OPTIMIZATION = "${@oe.utils.vartrue('DEBUG_BUILD', '-Og -g -feliminate-unused-debug-types', '-O2', d)} -pipe"
> diff --git a/meta/conf/distro/include/security_flags.inc b/meta/conf/distro/include/security_flags.inc
> index 4e64eb99f9..60370eeb17 100644
> --- a/meta/conf/distro/include/security_flags.inc
> +++ b/meta/conf/distro/include/security_flags.inc
> @@ -63,7 +63,7 @@ SECURITY_STACK_PROTECTOR_pn-glibc-testsuite = ""
>  # handled in recipes-graphics/xorg-driver/xorg-driver-common.inc
>  SECURITY_LDFLAGS_pn-xserver-xorg = "${SECURITY_X_LDFLAGS}"
>
> -TARGET_CC_ARCH_append_pn-binutils = " ${SELECTED_OPTIMIZATION}"
> -TARGET_CC_ARCH_append_pn-gcc = " ${SELECTED_OPTIMIZATION}"
> -TARGET_CC_ARCH_append_pn-gdb = " ${SELECTED_OPTIMIZATION}"
> -TARGET_CC_ARCH_append_pn-perf = " ${SELECTED_OPTIMIZATION}"
> +TARGET_CC_ARCH_append_pn-binutils = " ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
> +TARGET_CC_ARCH_append_pn-gcc = " ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
> +TARGET_CC_ARCH_append_pn-gdb = " ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
> +TARGET_CC_ARCH_append_pn-perf = " ${SELECTED_OPTIMIZATION} ${COMMON_OPTIMIZATION}"
> diff --git a/meta/conf/local.conf.sample.extended b/meta/conf/local.conf.sample.extended
> index 5ece522fa8..51cea43b9e 100644
> --- a/meta/conf/local.conf.sample.extended
> +++ b/meta/conf/local.conf.sample.extended
> @@ -99,6 +99,7 @@
>  #
>  # PROFILE_OPTIMIZATION = "-pg"
>  # SELECTED_OPTIMIZATION = "${PROFILE_OPTIMIZATION}"
> +# COMMON_OPTIMIZATION = ""
>  # LDFLAGS =+ "-pg"
>
>  # TCMODE controls the characteristics of the generated packages/images by
> diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> index bcba55f327..395d603cec 100644
> --- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> +++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> @@ -97,6 +97,7 @@ CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
>  # (via CFLAGS) means we interfere with that. Only pass DEBUG_FLAGS to it
>  # which fixes build path issue in DWARF.
>  SELECTED_OPTIMIZATION = "${DEBUG_FLAGS}"
> +COMMON_OPTIMIZATION = ""
>
>  do_configure_prepend () {
>      rm -rf ${S}/config.h
> --
> 2.11.0
>
>
> 
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 2/2] cmake: split release and debug flags
  2020-11-23 19:00 ` [OE-core][PATCH v2 2/2] cmake: split release and debug flags Andrej Valek
@ 2020-11-24 19:32   ` Khem Raj
  2020-11-25 10:23     ` Andrej Valek
  0 siblings, 1 reply; 15+ messages in thread
From: Khem Raj @ 2020-11-24 19:32 UTC (permalink / raw)
  To: Andrej Valek
  Cc: Patches and discussions about the oe-core layer, Pascal Bach,
	Adrian Freihofer

On Mon, Nov 23, 2020 at 11:04 AM Andrej Valek <andrej.valek@siemens.com> wrote:
>
> Keep only flags related to release in particular part _RELEASE (same for
> debug). This option allows to really use the Release/Debug build type
> in cmake. The corresponding build type will have corresponding flags set
> with/without optimization. Flags are respecting selected optimization from
> the whole build.
>
> Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>  meta/classes/cmake.bbclass | 36 ++++++++++++++++++++++++++++--------
>  1 file changed, 28 insertions(+), 8 deletions(-)
>
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index 7c055e8a3d..1305b40bf9 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -25,14 +25,25 @@ python() {
>  OECMAKE_AR ?= "${AR}"
>
>  # Compiler flags
> -OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
> -OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS}"
> -OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG"
> -OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
> -OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
> -OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"
> -CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
> -CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
> +OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CFLAGS_COMMON}"

CMAKE_<LANG>_FLAGS are seeded with CFLAGS/CXXFLAGS etc from the
environment and used during configure steps
when cmake is invoking compiler to compile small sample to determine
functionality and these tests will start to fail. especially
cases where we use security flags which should accompany some -On or
else compile will warn and if warnings are being treated
as errors then it will fail the test.

> +OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON}"
> +OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify} -DNDEBUG"
> +OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify} -DNDEBUG"
> +OECMAKE_C_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
> +OECMAKE_CXX_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
> +OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
> +OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON} ${LDFLAGS}"
> +OECMAKE_LINKER_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify}"
> +OECMAKE_LINKER_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
> +CXXFLAGS += "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS}"
> +CFLAGS += "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS}"
> +
> +# Common compiler flags
> +# CFLAGS/CXXFLAGS without optimization
> +# HOST_CC_ARCH without fortify
> +CFLAGS_COMMON = "${@d.getVar('CFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
> +CXXFLAGS_COMMON = "${@d.getVar('CXXFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
> +HOST_CC_ARCH_COMMON = "${@d.getVar('HOST_CC_ARCH').replace(d.getVar('lcl_maybe_fortify'),'')}"
>
>  def oecmake_map_compiler(compiler, d):
>      args = d.getVar(compiler).split()
> @@ -107,8 +118,17 @@ set( CMAKE_ASM_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "ASM FLAGS" )
>  set( CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional CFLAGS for release" )
>  set( CMAKE_CXX_FLAGS_RELEASE "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for release" )
>  set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING "Additional ASM FLAGS for release" )
> +set( CMAKE_C_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING "Additional CFLAGS for debug" )
> +set( CMAKE_CXX_FLAGS_DEBUG "${OECMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Additional CXXFLAGS for debug" )
> +set( CMAKE_ASM_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING "Additional ASM FLAGS for debug" )
>  set( CMAKE_C_LINK_FLAGS "${OECMAKE_C_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
>  set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )
> +set( CMAKE_SHARED_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional SHARED LINKER FLAGS for release" )
> +set( CMAKE_SHARED_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional SHARED LINKER FLAGS for debug" )
> +set( CMAKE_MODULE_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional MODULE LINKER FLAGS for release" )
> +set( CMAKE_MODULE_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional MODULE LINKER FLAGS for debug" )
> +set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional EXE LINKER FLAGS for release" )
> +set( CMAKE_EXE_LINKER_FLAGS_DEBUG "${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional EXE LINKER FLAGS for debug" )
>
>  # only search in the paths provided so cmake doesnt pick
>  # up libraries and tools from the native build machine
> --
> 2.11.0
>
>
> 
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 2/2] cmake: split release and debug flags
  2020-11-24 19:32   ` Khem Raj
@ 2020-11-25 10:23     ` Andrej Valek
  2020-11-25 15:45       ` Khem Raj
  0 siblings, 1 reply; 15+ messages in thread
From: Andrej Valek @ 2020-11-25 10:23 UTC (permalink / raw)
  To: Khem Raj
  Cc: Patches and discussions about the oe-core layer, Bach, Pascal,
	Freihofer, Adrian

What does it mean? Should I also "remove" the ${lcl_maybe_fortify} From C/CXXFLAGS?
Because I would like to keep them only in _RELEASE case.

Regards,
Andrej

>
>>> Keep only flags related to release in particular part _RELEASE (same
>> for debug). This option allows to really use the Release/Debug build
>> type in cmake. The corresponding build type will have corresponding
>> flags set with/without optimization. Flags are respecting selected
>> optimization from the whole build.
>>
>> Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
>> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
>> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
>> ---
>>  meta/classes/cmake.bbclass | 36 ++++++++++++++++++++++++++++--------
>>  1 file changed, 28 insertions(+), 8 deletions(-)
>>
>> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
>> index 7c055e8a3d..1305b40bf9 100644
>> --- a/meta/classes/cmake.bbclass
>> +++ b/meta/classes/cmake.bbclass
>> @@ -25,14 +25,25 @@ python() {
>>  OECMAKE_AR ?= "${AR}"
>>
>>  # Compiler flags
>> -OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
>> -OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS}"
>> -OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG"
>> -OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
>> -OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
>> -OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"
>> -CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
>> -CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
>> +OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CFLAGS_COMMON}"
>
> CMAKE_<LANG>_FLAGS are seeded with CFLAGS/CXXFLAGS etc from the environment and used during configure steps when cmake is invoking compiler to compile small sample to determine functionality and these tests will start to fail. especially cases where we use security flags which should accompany some -On or else compile will warn and if warnings are being treated as errors then it will fail the test.
>
>> +OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON}"
>> +OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify} -DNDEBUG"
>> +OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify} -DNDEBUG"
>> +OECMAKE_C_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
>> +OECMAKE_CXX_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
>> +OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
>> +OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON} ${LDFLAGS}"
>> +OECMAKE_LINKER_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify}"
>> +OECMAKE_LINKER_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
>> +CXXFLAGS += "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS}"
>> +CFLAGS += "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS}"
>> +
>> +# Common compiler flags
>> +# CFLAGS/CXXFLAGS without optimization # HOST_CC_ARCH without fortify
>> +CFLAGS_COMMON = "${@d.getVar('CFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
>> +CXXFLAGS_COMMON = "${@d.getVar('CXXFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
>> +HOST_CC_ARCH_COMMON = "${@d.getVar('HOST_CC_ARCH').replace(d.getVar('lcl_maybe_fortify'),'')}"
>>
>>  def oecmake_map_compiler(compiler, d):
>>      args = d.getVar(compiler).split() @@ -107,8 +118,17 @@ set(
>> CMAKE_ASM_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "ASM FLAGS" )  set(
>> CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING
>> "Additional CFLAGS for release" )  set( CMAKE_CXX_FLAGS_RELEASE
>> "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for
>> release" )  set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}"
>> CACHE STRING "Additional ASM FLAGS for release" )
>> +set( CMAKE_C_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING
>> +"Additional CFLAGS for debug" ) set( CMAKE_CXX_FLAGS_DEBUG
>> +"${OECMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Additional CXXFLAGS for
>> +debug" ) set( CMAKE_ASM_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE
>> +STRING "Additional ASM FLAGS for debug" )
>>  set( CMAKE_C_LINK_FLAGS "${OECMAKE_C_LINK_FLAGS}" CACHE STRING
>> "LDFLAGS" )  set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}"
>> CACHE STRING "LDFLAGS" )
>> +set( CMAKE_SHARED_LINKER_FLAGS_RELEASE
>> +"${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional SHARED
>> +LINKER FLAGS for release" ) set( CMAKE_SHARED_LINKER_FLAGS_DEBUG
>> +"${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional SHARED
>> +LINKER FLAGS for debug" ) set( CMAKE_MODULE_LINKER_FLAGS_RELEASE
>> +"${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional MODULE
>> +LINKER FLAGS for release" ) set( CMAKE_MODULE_LINKER_FLAGS_DEBUG
>> +"${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional MODULE
>> +LINKER FLAGS for debug" ) set( CMAKE_EXE_LINKER_FLAGS_RELEASE
>> +"${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional EXE LINKER
>> +FLAGS for release" ) set( CMAKE_EXE_LINKER_FLAGS_DEBUG
>> +"${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional EXE LINKER
>> +FLAGS for debug" )
>>
>>  # only search in the paths provided so cmake doesnt pick  # up
>> libraries and tools from the native build machine
>> --
>> 2.11.0
>>
>>
>> 
>>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part
  2020-11-23 19:00 ` [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part Andrej Valek
  2020-11-23 19:17   ` Richard Purdie
  2020-11-24 19:29   ` Khem Raj
@ 2020-11-25 10:30   ` Richard Purdie
  2020-11-25 16:58     ` Andrej Valek
  2 siblings, 1 reply; 15+ messages in thread
From: Richard Purdie @ 2020-11-25 10:30 UTC (permalink / raw)
  To: Andrej Valek, openembedded-core; +Cc: Pascal Bach, Adrian Freihofer

On Mon, 2020-11-23 at 20:00 +0100, Andrej Valek wrote:
> This option allows correctly handle the release/debug flags separation in
> upper recipe like cmake. Adopt SELECTED_OPTIMIZATION usage in other
> recipes.
> 
> Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>  meta/conf/bitbake.conf                            | 7 ++++---
>  meta/conf/distro/include/security_flags.inc       | 8 ++++----
>  meta/conf/local.conf.sample.extended              | 1 +
>  meta/recipes-devtools/valgrind/valgrind_3.16.1.bb | 1 +
>  4 files changed, 10 insertions(+), 7 deletions(-)

I am a bit worried about this as we're effectively letting cmake's idea
of flags separation determine how we have to set things in OE. Once we
go down this route, we're going to have problems any time we try and
add a new compiler flag.

What does this buy us in the end?

Cheers,

Richard


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 2/2] cmake: split release and debug flags
  2020-11-25 10:23     ` Andrej Valek
@ 2020-11-25 15:45       ` Khem Raj
  0 siblings, 0 replies; 15+ messages in thread
From: Khem Raj @ 2020-11-25 15:45 UTC (permalink / raw)
  To: Valek, Andrej
  Cc: Patches and discussions about the oe-core layer, Bach, Pascal,
	Freihofer, Adrian

On Wed, Nov 25, 2020 at 2:23 AM Valek, Andrej <andrej.valek@siemens.com> wrote:
>
> What does it mean? Should I also "remove" the ${lcl_maybe_fortify} From C/CXXFLAGS?
> Because I would like to keep them only in _RELEASE case.
>

I think that will mean cmake will ignore security flags. Aside from
this I really don't encourage the concept of
release vs debug. one should debug what is shipped. This catches maximum bugs.

> Regards,
> Andrej
>
> >
> >>> Keep only flags related to release in particular part _RELEASE (same
> >> for debug). This option allows to really use the Release/Debug build
> >> type in cmake. The corresponding build type will have corresponding
> >> flags set with/without optimization. Flags are respecting selected
> >> optimization from the whole build.
> >>
> >> Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
> >> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
> >> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> >> ---
> >>  meta/classes/cmake.bbclass | 36 ++++++++++++++++++++++++++++--------
> >>  1 file changed, 28 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> >> index 7c055e8a3d..1305b40bf9 100644
> >> --- a/meta/classes/cmake.bbclass
> >> +++ b/meta/classes/cmake.bbclass
> >> @@ -25,14 +25,25 @@ python() {
> >>  OECMAKE_AR ?= "${AR}"
> >>
> >>  # Compiler flags
> >> -OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}"
> >> -OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS}"
> >> -OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG"
> >> -OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
> >> -OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
> >> -OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"
> >> -CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
> >> -CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
> >> +OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CFLAGS_COMMON}"
> >
> > CMAKE_<LANG>_FLAGS are seeded with CFLAGS/CXXFLAGS etc from the environment and used during configure steps when cmake is invoking compiler to compile small sample to determine functionality and these tests will start to fail. especially cases where we use security flags which should accompany some -On or else compile will warn and if warnings are being treated as errors then it will fail the test.
> >
> >> +OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON}"
> >> +OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify} -DNDEBUG"
> >> +OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify} -DNDEBUG"
> >> +OECMAKE_C_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
> >> +OECMAKE_CXX_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
> >> +OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
> >> +OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS_COMMON} ${LDFLAGS}"
> >> +OECMAKE_LINKER_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${lcl_maybe_fortify}"
> >> +OECMAKE_LINKER_FLAGS_DEBUG ?= "${DEBUG_OPTIMIZATION}"
> >> +CXXFLAGS += "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS}"
> >> +CFLAGS += "${HOST_CC_ARCH_COMMON} ${TOOLCHAIN_OPTIONS}"
> >> +
> >> +# Common compiler flags
> >> +# CFLAGS/CXXFLAGS without optimization # HOST_CC_ARCH without fortify
> >> +CFLAGS_COMMON = "${@d.getVar('CFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
> >> +CXXFLAGS_COMMON = "${@d.getVar('CXXFLAGS').replace(d.getVar('SELECTED_OPTIMIZATION'),'')}"
> >> +HOST_CC_ARCH_COMMON = "${@d.getVar('HOST_CC_ARCH').replace(d.getVar('lcl_maybe_fortify'),'')}"
> >>
> >>  def oecmake_map_compiler(compiler, d):
> >>      args = d.getVar(compiler).split() @@ -107,8 +118,17 @@ set(
> >> CMAKE_ASM_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "ASM FLAGS" )  set(
> >> CMAKE_C_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}" CACHE STRING
> >> "Additional CFLAGS for release" )  set( CMAKE_CXX_FLAGS_RELEASE
> >> "${OECMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "Additional CXXFLAGS for
> >> release" )  set( CMAKE_ASM_FLAGS_RELEASE "${OECMAKE_C_FLAGS_RELEASE}"
> >> CACHE STRING "Additional ASM FLAGS for release" )
> >> +set( CMAKE_C_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE STRING
> >> +"Additional CFLAGS for debug" ) set( CMAKE_CXX_FLAGS_DEBUG
> >> +"${OECMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "Additional CXXFLAGS for
> >> +debug" ) set( CMAKE_ASM_FLAGS_DEBUG "${OECMAKE_C_FLAGS_DEBUG}" CACHE
> >> +STRING "Additional ASM FLAGS for debug" )
> >>  set( CMAKE_C_LINK_FLAGS "${OECMAKE_C_LINK_FLAGS}" CACHE STRING
> >> "LDFLAGS" )  set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}"
> >> CACHE STRING "LDFLAGS" )
> >> +set( CMAKE_SHARED_LINKER_FLAGS_RELEASE
> >> +"${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional SHARED
> >> +LINKER FLAGS for release" ) set( CMAKE_SHARED_LINKER_FLAGS_DEBUG
> >> +"${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional SHARED
> >> +LINKER FLAGS for debug" ) set( CMAKE_MODULE_LINKER_FLAGS_RELEASE
> >> +"${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional MODULE
> >> +LINKER FLAGS for release" ) set( CMAKE_MODULE_LINKER_FLAGS_DEBUG
> >> +"${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional MODULE
> >> +LINKER FLAGS for debug" ) set( CMAKE_EXE_LINKER_FLAGS_RELEASE
> >> +"${OECMAKE_LINKER_FLAGS_RELEASE}" CACHE STRING "Additional EXE LINKER
> >> +FLAGS for release" ) set( CMAKE_EXE_LINKER_FLAGS_DEBUG
> >> +"${OECMAKE_LINKER_FLAGS_DEBUG}" CACHE STRING "Additional EXE LINKER
> >> +FLAGS for debug" )
> >>
> >>  # only search in the paths provided so cmake doesnt pick  # up
> >> libraries and tools from the native build machine
> >> --
> >> 2.11.0
> >>
> >>
> >> 
> >>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part
  2020-11-25 10:30   ` Richard Purdie
@ 2020-11-25 16:58     ` Andrej Valek
  0 siblings, 0 replies; 15+ messages in thread
From: Andrej Valek @ 2020-11-25 16:58 UTC (permalink / raw)
  To: Richard Purdie, Khem Raj, openembedded-core
  Cc: Bach, Pascal, Freihofer, Adrian

Ok guys, I gave up for now.

Maybe I will try to fix it in the future, or somebody else can do that ...

Cheers,
Andrej

>> This option allows correctly handle the release/debug flags separation 
>> in upper recipe like cmake. Adopt SELECTED_OPTIMIZATION usage in other 
>> recipes.
>> 
>> Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
>> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
>> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
>> ---
>>  meta/conf/bitbake.conf                            | 7 ++++---
>>  meta/conf/distro/include/security_flags.inc       | 8 ++++----
>>  meta/conf/local.conf.sample.extended              | 1 +
>>  meta/recipes-devtools/valgrind/valgrind_3.16.1.bb | 1 +
>>  4 files changed, 10 insertions(+), 7 deletions(-)
>
> I am a bit worried about this as we're effectively letting cmake's idea of flags separation determine how we have to set > things in OE. Once we go down this route, we're going to have problems any time we try and add a new compiler flag.
>
> What does this buy us in the end?
>
> Cheers,
>
> Richard


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-11-25 16:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-22 12:48 [OE-core][PATCH 1/2] bitbake.conf: Split optimization into common part Andrej Valek
2020-11-22 12:48 ` [OE-core][PATCH 2/2] cmake: split release and debug flags Andrej Valek
2020-11-23 15:03   ` Khem Raj
2020-11-23 19:00 ` [OE-core][PATCH v2 1/2] bitbake.conf: Split optimization into common part Andrej Valek
2020-11-23 19:17   ` Richard Purdie
2020-11-24  8:01     ` Andrej Valek
2020-11-24 13:34       ` Richard Purdie
2020-11-24 18:47         ` Andrej Valek
2020-11-24 19:29   ` Khem Raj
2020-11-25 10:30   ` Richard Purdie
2020-11-25 16:58     ` Andrej Valek
2020-11-23 19:00 ` [OE-core][PATCH v2 2/2] cmake: split release and debug flags Andrej Valek
2020-11-24 19:32   ` Khem Raj
2020-11-25 10:23     ` Andrej Valek
2020-11-25 15:45       ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.