From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: kubiznak@2n.com,
"openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] meson: buildtype flags get overriden by CFLAGS
Date: Wed, 04 Feb 2026 15:48:21 +0000 [thread overview]
Message-ID: <31db3ad25183f3d6b7d31987c70d10c7181aef3a.camel@linuxfoundation.org> (raw)
In-Reply-To: <DB4PR02MB10030DB96660867379C9C45C0E2B02@DB4PR02MB10030.eurprd02.prod.outlook.com>
On Tue, 2024-07-30 at 12:59 +0000, Petr Kubizňák via
lists.openembedded.org wrote:
> I have issues with setting optimization flags in meson-built project.
>
> 1. In do_write_config task, meson.cross is generated with `c = ${CC}`
> and `c_args = ${CFLAGS}`.
> 2. In do_configure, meson setup is called with recipe-defined
> buildtype and generated meson.cross file.
> 3. In do_compile, compile commands are composed roughly as `$c
> <meson_flags> $c_args`, i.e. `${CC} <meson_flags> ${CFLAGS}`. Recipe-
> defined buildtype propagates as optimization flags into <meson_flags>
> (based on
> https://mesonbuild.com/Builtin-options.html#details-for-buildtype map
> ping).
>
> CFLAGS is composed of TARGET_CFLAGS, which is in turn composed of
> SELECTED_OPTIMIZATION, which equals either DEBUG_OPTIMIZATION ("-Og
> ${DEBUG_FLAGS} -pipe") or FULL_OPTIMIZATION ("-O2 -pipe
> ${DEBUG_FLAGS}"), based on value of DEBUG_BUILD. In any case, CFLAGS
> features optimization flags including -Ox.
>
> As a result, the -Oy flag in <meson_flags> does not have any effect
> because it is always overriden by ${CFLAGS}.
>
> Is it intentional that meson buildtype has in fact no effect? Or am I
> missing something?
I suspect most users would want OE's flags to win over meson's ideas on
which ones might apply so that doesn't seem unreasonable. We might want
to document that we effectively override the buildtype in the class
though?
Cheers,
Richard
prev parent reply other threads:[~2026-02-04 15:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 12:59 meson: buildtype flags get overriden by CFLAGS Petr Kubizňák - 2N
2026-02-04 15:48 ` Richard Purdie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=31db3ad25183f3d6b7d31987c70d10c7181aef3a.camel@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--cc=kubiznak@2n.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox