Openembedded Core Discussions
 help / color / mirror / Atom feed
* [meson.bbclass] bindgen_clang_arguments lacks C++ include paths, breaks C++ bindgen (mesa rusticl)
@ 2026-09-19 17:28 Royyan Zahir
  2026-09-21  8:14 ` Paul Barker
  2026-09-21  9:11 ` Royyan Zahir
  0 siblings, 2 replies; 5+ messages in thread
From: Royyan Zahir @ 2026-09-19 17:28 UTC (permalink / raw)
  To: openembedded-core

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-21 16:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-19 17:28 [meson.bbclass] bindgen_clang_arguments lacks C++ include paths, breaks C++ bindgen (mesa rusticl) Royyan Zahir
2026-09-21  8:14 ` Paul Barker
2026-09-21  9:11 ` Royyan Zahir
2026-09-21 10:09   ` Paul Barker
2026-09-21 15:52   ` Royyan Zahir

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox