Revert "cmake.bbclass: Set CXXFLAGS and CFLAGS"

Message ID 20220228163710.44361-1-quaresma.jose@gmail.com
State Accepted, archived
Commit a83623a54a375d3ae9198a135b94379881a2b7a5
Headers show
Series Revert "cmake.bbclass: Set CXXFLAGS and CFLAGS" | expand

Commit Message

Jose Quaresma Feb. 28, 2022, 4:37 p.m. UTC
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" )

CC: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
 meta/classes/cmake.bbclass | 2 --
 1 file changed, 2 deletions(-)

Comments

Khem Raj March 1, 2022, 4:17 a.m. UTC | #1
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.

On Mon, Feb 28, 2022 at 8:37 AM Jose Quaresma <quaresma.jose@gmail.com> wrote:
>
> 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" )
>
> CC: Khem Raj <raj.khem@gmail.com>
> Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
> ---
>  meta/classes/cmake.bbclass | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> index fac7bbca7a..d9bcddbdbb 100644
> --- a/meta/classes/cmake.bbclass
> +++ b/meta/classes/cmake.bbclass
> @@ -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
>
Richard Purdie March 1, 2022, 7:50 a.m. UTC | #2
On Mon, 2022-02-28 at 20:17 -0800, Khem Raj wrote:
> 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
Jose Quaresma March 2, 2022, 12:29 a.m. UTC | #3
Khem Raj <raj.khem@gmail.com> escreveu no dia terça, 1/03/2022 à(s) 04:18:

> 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


> On Mon, Feb 28, 2022 at 8:37 AM Jose Quaresma <quaresma.jose@gmail.com>
> wrote:
> >
> > 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" )
> >
> > CC: Khem Raj <raj.khem@gmail.com>
> > Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
> > ---
> >  meta/classes/cmake.bbclass | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
> > index fac7bbca7a..d9bcddbdbb 100644
> > --- a/meta/classes/cmake.bbclass
> > +++ b/meta/classes/cmake.bbclass
> > @@ -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
> >
>
Jose Quaresma March 2, 2022, 12:42 a.m. UTC | #4
Richard Purdie <richard.purdie@linuxfoundation.org> escreveu no dia terça,
1/03/2022 à(s) 07:50:

> On Mon, 2022-02-28 at 20:17 -0800, Khem Raj wrote:
> > 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.
>

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


> Cheers,
>
> Richard
>
>

Patch

diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass
index fac7bbca7a..d9bcddbdbb 100644
--- a/meta/classes/cmake.bbclass
+++ b/meta/classes/cmake.bbclass
@@ -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()