Skip to contentSkip to conversation

Revert "cmake.bbclass: Set CXXFLAGS and CFLAGS"

PATCH In review Jose Quaresma 3 participants 5 messages Feb 28, 2022 – Mar 2, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "cmake.bbclass: Set CXXFLAGS and CFLAGS"

This reverts commit 47594d59ec4ab82fcf87d3c590caf7c46a6bfdff.

This patch was introduced 5 years ago as a temporary workaround to fix an upstream bug.

Currently with that patch the following flags are duplicated:
OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}" OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}" OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"

The duplicated flags is used in the toolchain.cmake:
set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" ) set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" ) set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )

---
 meta/classes/cmake.bbclass | 2 --
 1 file changed, 2 deletions(-)
meta/classes/cmake.bbclass +0 -2
index fac7bbca7a..d9bcddbdbb 100644
@@ -31,8 +31,6 @@ 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}"
 
 def oecmake_map_compiler(compiler, d):
     args = d.getVar(compiler).split()
Signature · 1 line
2.35.1
#1 lore raw

this is fixing more than the workaround, e.g. see the patch I sent to fix libical, where these flags are not passed to git compiler when using cmake
I am not sure how many such fallouts there will be through out.

Quoted 38 lines · Jose Quaresma

This reverts commit 47594d59ec4ab82fcf87d3c590caf7c46a6bfdff.

This patch was introduced 5 years ago as a temporary workaround to fix an upstream bug.

Currently with that patch the following flags are duplicated:
OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}" OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}" OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"

The duplicated flags is used in the toolchain.cmake:
set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" ) set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" ) set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING "LDFLAGS" )

---
 meta/classes/cmake.bbclass | 2 --
 1 file changed, 2 deletions(-)
meta/classes/cmake.bbclass +0 -3
index fac7bbca7a..d9bcddbdbb 100644
@@ -31,8 +31,6 @@ 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}"
 
 def oecmake_map_compiler(compiler, d):
     args = d.getVar(compiler).split()
--

2.35.1

#2 lore raw
Quoted 4 lines · Khem Raj

this is fixing more than the workaround, e.g. see the patch I sent to fix libical, where these flags are not passed to git compiler when using cmake
I am not sure how many such fallouts there will be through out.

The error Khem mentions is here:

https://autobuilder.yoctoproject.org/typhoon/#/builders/65/builds/4839/steps/11/logs/stdio

with multiple other failures in that build in libical. I'm worried about other failures resulting from this change.

Cheers,

Richard

#3 lore raw

Richard Purdie <[email protected]> escreveu no dia terça, 1/03/2022 à(s) 07:50:

Quoted 6 lines · Khem Raj
Quoted 4 lines

this is fixing more than the workaround, e.g. see the patch I sent to fix libical, where these flags are not passed to git compiler when using cmake
I am not sure how many such fallouts there will be through out.

Quoted 9 lines

The error Khem mentions is here:

https://autobuilder.yoctoproject.org/typhoon/#/builders/65/builds/4839/steps/11/logs/stdio

with multiple other failures in that build in libical. I'm worried about other
failures resulting from this change.

Thanks for the link, I can reproduce it on my side and it fails when the gobject-introspection is enabled
and as I said to Khem I think that it's not related to cmake. However I will try to build more cmake on oe-core to see if there are more issues.

Without this patch none of the following variables makes much sense:

OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}" OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS}" OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS} ${LDFLAGS}"
OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} ${LDFLAGS}"

Jose

Quoted 5 lines

Cheers,

Richard

Signature · 3 lines
Best regards,

José Quaresma
#4 lore raw
In reply to Khem Raj

Khem Raj <[email protected]> escreveu no dia terça, 1/03/2022 à(s) 04:18:

Quoted 5 lines

this is fixing more than the workaround, e.g. see the patch I sent to fix libical, where these flags are not passed to git compiler when using cmake
I am not sure how many such fallouts there will be through out.

I have looked on the libcal and I think that it is another issue with the g-ir-scanner-wrapper
that doesn't use the cmake cflags CMAKE_C_FLAGS.
I can build the libcal with this patch disabling the gobject-introspection with GI_DATA_ENABLED = "False"

Jose

Quoted 46 lines
Quoted 9 lines · Jose Quaresma

This reverts commit 47594d59ec4ab82fcf87d3c590caf7c46a6bfdff.

This patch was introduced 5 years ago as a temporary workaround to fix an upstream bug.

Currently with that patch the following flags are duplicated:
OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}" OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}

${CPPFLAGS} ${LDFLAGS}"

Quoted 1 line

OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}

${CXXFLAGS} ${LDFLAGS}"

Quoted 5 lines

The duplicated flags is used in the toolchain.cmake:
set( CMAKE_C_FLAGS "${OECMAKE_C_FLAGS}" CACHE STRING "CFLAGS" ) set( CMAKE_CXX_FLAGS "${OECMAKE_CXX_FLAGS}" CACHE STRING "CXXFLAGS" ) set( CMAKE_CXX_LINK_FLAGS "${OECMAKE_CXX_LINK_FLAGS}" CACHE STRING

"LDFLAGS" )

Quoted 12 lines
---
 meta/classes/cmake.bbclass | 2 --
 1 file changed, 2 deletions(-)
meta/classes/cmake.bbclass +0 -0
index fac7bbca7a..d9bcddbdbb 100644

meta/classes/cmake.bbclass OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG" · line 32

Quoted 2 lines
meta/classes/cmake.bbclass +0 -0
@@ -31,8 +31,6 @@ OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG"
 OECMAKE_CXX_FLAGS_RELEASE ?= "-DNDEBUG"
 OECMAKE_C_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}

${CPPFLAGS} ${LDFLAGS}"

meta/classes/cmake.bbclass OECMAKE_C_FLAGS_RELEASE ?= "-DNDEBUG" · line 33

Quoted 1 line
meta/classes/cmake.bbclass +0 -0
 OECMAKE_CXX_LINK_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}

${CXXFLAGS} ${LDFLAGS}"

Quoted 8 lines
meta/classes/cmake.bbclass +0 -3
-CXXFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
-CFLAGS += "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}"
 
 def oecmake_map_compiler(compiler, d):
     args = d.getVar(compiler).split()
--

2.35.1

Signature · 3 lines
Best regards,

José Quaresma