diff options
| author | Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> | 2025-05-05 19:22:30 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-08 10:28:18 +0100 |
| commit | d7f705d412e1d8c779b29b62d8e19901c7c01c6b (patch) | |
| tree | c99a70b2ef9486b606291e62d6d7b03e05bd168b | |
| parent | 251fd55c27372d34d3d088815297d443856c4080 (diff) | |
| download | poky-d7f705d412e1d8c779b29b62d8e19901c7c01c6b.tar.gz | |
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.
(From OE-Core rev: a647a0ff4c4eb7a7c1f6ec84a574f7d7796b6178)
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes-recipe/meson.bbclass | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass index ef45a034a7..c8b3e1ec29 100644 --- a/meta/classes-recipe/meson.bbclass +++ b/meta/classes-recipe/meson.bbclass | |||
| @@ -62,6 +62,14 @@ def rust_tool(d, target_var): | |||
| 62 | cmd = [rustc, "--target", d.getVar(target_var)] + d.getVar("RUSTFLAGS").split() | 62 | cmd = [rustc, "--target", d.getVar(target_var)] + d.getVar("RUSTFLAGS").split() |
| 63 | return "rust = %s" % repr(cmd) | 63 | return "rust = %s" % repr(cmd) |
| 64 | 64 | ||
| 65 | def bindgen_args(d): | ||
| 66 | args = '${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} --target=${TARGET_SYS}' | ||
| 67 | # For SDK packages TOOLCHAIN_OPTIONS don't contain full sysroot path | ||
| 68 | if bb.data.inherits_class("nativesdk", d): | ||
| 69 | args += ' --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE}${prefix_nativesdk}' | ||
| 70 | items = d.expand(args).split() | ||
| 71 | return repr(items[0] if len(items) == 1 else items) | ||
| 72 | |||
| 65 | addtask write_config before do_configure | 73 | addtask write_config before do_configure |
| 66 | do_write_config[vardeps] += "CC CXX AR NM STRIP READELF OBJCOPY CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS EXEWRAPPER_ENABLED" | 74 | do_write_config[vardeps] += "CC CXX AR NM STRIP READELF OBJCOPY CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS EXEWRAPPER_ENABLED" |
| 67 | do_write_config() { | 75 | do_write_config() { |
| @@ -93,7 +101,7 @@ cpp_link_args = ${@meson_array('LDFLAGS', d)} | |||
| 93 | [properties] | 101 | [properties] |
| 94 | needs_exe_wrapper = true | 102 | needs_exe_wrapper = true |
| 95 | sys_root = '${STAGING_DIR_HOST}' | 103 | sys_root = '${STAGING_DIR_HOST}' |
| 96 | bindgen_clang_arguments = ['-target', '${@d.getVar('RUST_HOST_SYS')}', '-I${STAGING_INCDIR}'] | 104 | bindgen_clang_arguments = ${@bindgen_args(d)} |
| 97 | 105 | ||
| 98 | [host_machine] | 106 | [host_machine] |
| 99 | system = '${@meson_operating_system('HOST_OS', d)}' | 107 | system = '${@meson_operating_system('HOST_OS', d)}' |
