All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Antonin Godard" <antonin.godard@bootlin.com>
To: <yoann.congal@smile.fr>, <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] insane: Check if the C++ toolchain supports --std=gnu++20
Date: Thu, 20 Mar 2025 09:36:45 +0100	[thread overview]
Message-ID: <D8KYG809KNRC.1TPCGXGFZBJBT@bootlin.com> (raw)
In-Reply-To: <20250319182029.675932-1-yoann.congal@smile.fr>

Hi Yoann,

On Wed Mar 19, 2025 at 7:20 PM CET, Yoann Congal via lists.openembedded.org wrote:
> From: Yoann Congal <yoann.congal@smile.fr>
>
> This is needed to build nodejs from meta-oe. Check this early to avoid
> an error later in the build.
>
> Fixes [YOCTO #15804]
>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> ---
> WARNING: as discussed in previous threads [0][1], this will disqualify
> builds on Ubuntu 20.04 (its g++ does not support the option)
> [0]: https://lists.openembedded.org/g/openembedded-devel/topic/111740469
> [1]: https://lists.yoctoproject.org/g/yocto-patches/topic/yocto_autobuilder2_patch/111757761
> ---
>  meta/classes-global/sanity.bbclass | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/meta/classes-global/sanity.bbclass b/meta/classes-global/sanity.bbclass
> index 1bae998f74..5783b92b26 100644
> --- a/meta/classes-global/sanity.bbclass
> +++ b/meta/classes-global/sanity.bbclass
> @@ -629,6 +629,28 @@ def check_cpp_toolchain(d):
>      except subprocess.CalledProcessError as e:
>          return f"An unexpected issue occurred during the C++ toolchain check: {str(e)}"
>  
> +def check_cpp_stdgnupp20_toolchain(d):
> +    """
> +    Checks if the C++ toolchain support the '--std=gnu++20' option
> +    """
> +    import shlex
> +    import subprocess
> +
> +    cpp_code = """
> +    #include <iostream>
> +    int main() {
> +        std::cout << "Hello, World!" << std::endl;
> +        return 0;
> +    }
> +    """
> +
> +    cmd = shlex.split(d.getVar("BUILD_CXX")) + ["-x", "c++","-", "-o", "/dev/null", "--std=gnu++20"]
> +    try:
> +        subprocess.run(cmd, input=cpp_code, capture_output=True, text=True, check=True)
> +        return None
> +    except subprocess.CalledProcessError as e:
> +        return f"An unexpected issue occurred during the C++ 'std=gnu++20' toolchain check: {str(e)}"
> +
>  def sanity_handle_abichanges(status, d):
>      #
>      # Check the 'ABI' of TMPDIR
> @@ -804,6 +826,9 @@ def check_sanity_version_change(status, d):
>      # Check if linking with lstdc++ is failing
>      status.addresult(check_cpp_toolchain(d))
>  
> +    # Check if the C++ toolchain supports --std=gnu++20
> +    status.addresult(check_cpp_stdgnupp20_toolchain(d))

The code in check_cpp_stdgnupp20_toolchain is very similar to
check_cpp_toolchain, maybe an opportunity to do something like
check_cpp_toolchain(d, flag)?

Antonin

-- 
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


      parent reply	other threads:[~2025-03-20  8:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19 18:20 [PATCH] insane: Check if the C++ toolchain supports --std=gnu++20 Yoann Congal
2025-03-19 19:19 ` [OE-core] " Richard Purdie
2025-03-20  8:36 ` Antonin Godard [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=D8KYG809KNRC.1TPCGXGFZBJBT@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=yoann.congal@smile.fr \
    /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 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.