From: Dmitry Baryshkov Date: Tue, 6 May 2025 02:22:30 +0000 (-0700) Subject: meson: correct bindgen_clang_argments X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a647a0ff4c4eb7a7c1f6ec84a574f7d7796b6178;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git meson: correct bindgen_clang_argments Follow the changes in Clang search paths and specify sysroot via the TOOLCHAIN_OPTIONS, otherwise clang will fail to find system headers when executed by bindgen. For SDK packages TOOLCHAIN_OPTIONS don't contain full sysroot path, so specify the correct directory explicitly. Signed-off-by: Dmitry Baryshkov Signed-off-by: Khem Raj Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass index ef45a034a76..c8b3e1ec29a 100644 --- a/meta/classes-recipe/meson.bbclass +++ b/meta/classes-recipe/meson.bbclass @@ -62,6 +62,14 @@ def rust_tool(d, target_var): cmd = [rustc, "--target", d.getVar(target_var)] + d.getVar("RUSTFLAGS").split() return "rust = %s" % repr(cmd) +def bindgen_args(d): + args = '${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} --target=${TARGET_SYS}' + # For SDK packages TOOLCHAIN_OPTIONS don't contain full sysroot path + if bb.data.inherits_class("nativesdk", d): + args += ' --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE}${prefix_nativesdk}' + items = d.expand(args).split() + return repr(items[0] if len(items) == 1 else items) + addtask write_config before do_configure do_write_config[vardeps] += "CC CXX AR NM STRIP READELF OBJCOPY CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS EXEWRAPPER_ENABLED" do_write_config() { @@ -93,7 +101,7 @@ cpp_link_args = ${@meson_array('LDFLAGS', d)} [properties] needs_exe_wrapper = true sys_root = '${STAGING_DIR_HOST}' -bindgen_clang_arguments = ['-target', '${@d.getVar('RUST_HOST_SYS')}', '-I${STAGING_INCDIR}'] +bindgen_clang_arguments = ${@bindgen_args(d)} [host_machine] system = '${@meson_operating_system('HOST_OS', d)}'