Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Royyan Zahir <royzah@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [meson.bbclass] bindgen_clang_arguments lacks C++ include paths, breaks C++ bindgen (mesa rusticl)
Date: Sat, 19 Sep 2026 21:28:26 +0400	[thread overview]
Message-ID: <20260919172851.1564760-1-royzah@gmail.com> (raw)

meson.bbclass builds the bindgen arguments as:

    def bindgen_args(d):
        args = '${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} --target=${TARGET_SYS}'

TOOLCHAIN_OPTIONS carries --sysroot, which is enough for C headers. It is not
enough for C++: when clang cross-compiles against a GCC sysroot it does not
infer the libstdc++ include directories from --sysroot alone, so any recipe
running bindgen over a C++ header fails to find the standard library.

mesa hits this with PACKAGECONFIG opencl, which turns on gallium-rusticl and
runs bindgen over rusticl_llvm_bindings.hpp with -x c++ -std=c++17:

    FAILED: src/gallium/frontends/rusticl/rusticl_llvm_bindings.rs
    .../recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10:
        fatal error: 'cassert' file not found
    Unable to generate bindings: clang diagnosed error

Seen on mesa 26.0.5 with oe-core wrynose, aarch64 target, LLVM 22.1.3.

The missing arguments are the staged C++ headers:

    -I${STAGING_INCDIR}/c++/<version>
    -I${STAGING_INCDIR}/c++/<version>/${TARGET_SYS}

Our downstream workaround appends them to bindgen_clang_arguments in
meson.cross from a mesa bbappend, which works but is recipe-specific and
hardcodes a realpath glob over the staged header directory. It also has to run
after do_prepare_recipe_sysroot, since the glob is empty on a clean build.

Reporting rather than sending a patch because the right fix is a design call:
bindgen_args() is generic, so this affects any meson recipe doing C++ bindgen,
not just mesa. Options seem to be teaching bindgen_args() about the C++ include
paths unconditionally, gating it on whether the recipe does C++ bindgen, or
having clang-native resolve the GCC sysroot properly. A maintainer is better
placed to pick.

Happy to test a proposed fix on aarch64.


             reply	other threads:[~2026-09-21  5:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 17:28 Royyan Zahir [this message]
2026-09-21  8:14 ` [meson.bbclass] bindgen_clang_arguments lacks C++ include paths, breaks C++ bindgen (mesa rusticl) Paul Barker
2026-09-21  9:11 ` Royyan Zahir
2026-09-21 10:09   ` Paul Barker
2026-09-21 15:52   ` Royyan Zahir

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=20260919172851.1564760-1-royzah@gmail.com \
    --to=royzah@gmail.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