Skip to contentSkip to conversation

mesa: Fix bindgen includes

PATCH In review Zoltán Böszörményi 2 participants 9 messages Jun 10, 2025 – Jun 12, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mesa: Fix bindgen includes

Add a patch to fix bindgen errors due to not finding headers in the system, like:

|...
| ../mesa-25.1.2/src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
| Unable to generate bindings: clang diagnosed error: ../mesa-25.1.2/src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
|...
| .../work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found
| Unable to generate bindings: clang diagnosed error: /data2/dtd-yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found
---
 ...w-build-option-for-extra-bindgen-inc.patch | 57 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc           |  3 +-
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-Add-a-new-build-option-for-extra-bindgen-inc.patch
meta/recipes-graphics/mesa/files/0001-rusticl-Add-a-new-build-option-for-extra-bindgen-inc.patch new file +57 -0
new file mode 100644
index 0000000000..913357c5dc
@@ -0,0 +1,57 @@
+From 705309ce727575faac44f6399463616beeafbfa0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <[email protected]>
+Date: Tue, 10 Jun 2025 15:50:08 +0200
+Subject: [PATCH] rusticl: Add a new build option for extra bindgen include
+ dirs
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Bindgen may need extra -I options when headers are not in
+the usual places, like when cross-compiling.
+
+Signed-off-by: Zoltán Böszörményi <[email protected]>
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435]
+---
+ meson.options                             | 7 +++++++
+ src/gallium/frontends/rusticl/meson.build | 5 +++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/meson.options b/meson.options
+index 40fe433435a..65d1c236261 100644
+--- a/meson.options
++++ b/meson.options
+@@ -787,6 +787,13 @@ option(
+   ],
+ )
+ 
++option(
++  'bindgen-includes',
++  type : 'array',
++  value : [],
++  description : 'Pass extra -I options to bindgen (if needed for cross builds).'
++)
++
+ option(
+   'mesa-clc',
+   type : 'combo',
+diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build
+index 426b0a9b993..20e0d7682ea 100644
+--- a/src/gallium/frontends/rusticl/meson.build
++++ b/src/gallium/frontends/rusticl/meson.build
+@@ -106,6 +106,11 @@ rusticl_bindgen_c_args = [
+   '-fno-builtin-malloc',
+ ]
+ 
++_bindgen_includes = get_option('bindgen-includes')
++foreach _bindgen_include : _bindgen_includes
++  rusticl_bindgen_c_args += '-I' + _bindgen_include
++endforeach
++
+ cl_c_args = [
+   '-DCL_USE_DEPRECATED_OPENCL_1_0_APIS',
+   '-DCL_USE_DEPRECATED_OPENCL_1_1_APIS',
+-- 
+2.49.0
+
meta/recipes-graphics/mesa/mesa.inc +2 -1
index b222e72fdd..3179023efb 100644
@@ -18,6 +18,7 @@ SRC_URI = "https://archive.mesa3d.org/mesa-${PV}.tar.xz \
            file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
            file://0001-freedreno-don-t-encode-build-path-into-binaries.patch \
            file://0001-dont-build-clover-frontend.patch \
+           file://0001-rusticl-Add-a-new-build-option-for-extra-bindgen-inc.patch \
 "
 
 SRC_URI[sha256sum] = "ffcb6cadb5fd356d56008e6308641dfe4b2929f30139f6585436ca6e3cddba7f"
@@ -151,7 +152,7 @@ PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
 
 # "opencl" also requires libclc and gallium-llvm to be present in PKGCONFIG!
 # Be sure to enable them both for the target and for the native build.
-PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true, -Dgallium-rusticl=false, bindgen-cli-native"
+PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true -Dbindgen-includes=${STAGING_INCDIR}, -Dgallium-rusticl=false, bindgen-cli-native"
 
 PACKAGECONFIG[broadcom] = ""
 PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native"
Signature · 1 line
2.49.0
#1 lore raw
Quoted 10 lines · Zoltán Böszörményi

Add a patch to fix bindgen errors due to not finding headers in the system, like:

|...
| ../mesa-25.1.2/src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
| Unable to generate bindings: clang diagnosed error: ../mesa-25.1.2/src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
|...
| .../work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found
| Unable to generate bindings: clang diagnosed error: /data2/dtd-yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found

Can we fix this on the meson side by passing additional include path through the cross file?

Quoted 8 lines
---
 ...w-build-option-for-extra-bindgen-inc.patch | 57 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc           |  3 +-
 2 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-Add-a-new-build-option-for-extra-bindgen-inc.patch
Signature · 2 lines
With best wishes
Dmitry
#2 lore raw

2025. 06. 10. 21:49 keltezéssel, Dmitry Baryshkov via lists.openembedded.org írta:

Quoted 12 lines · Zoltán Böszörményi
Quoted 9 lines

Add a patch to fix bindgen errors due to not finding headers in the system, like:

|...
| ../mesa-25.1.2/src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
| Unable to generate bindings: clang diagnosed error: ../mesa-25.1.2/src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
|...
| .../work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found
| Unable to generate bindings: clang diagnosed error: /data2/dtd-yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found

Can we fix this on the meson side by passing additional include path through the cross file?

This seems to work in mesa.inc without patching Mesa:

CFLAGS:append:class-target = " -I${STAGING_INCDIR}" CXXFLAGS:append:class-target = " -I${STAGING_INCDIR}"

but it also[1] prints this for some of the bindgen runs:

clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:95:11: warning: '__INT64_C' macro redefined [-Wmacro-redefined] clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:96:11: warning: '__UINT64_C' macro redefined [-Wmacro-redefined]

[1] Using the previously posted patch also prints the same.

It seems to be caused by a meson bug because it doesn't collect the -isystem or --sysroot flags for rust/bindgen. See the discussion at the MR link in the patch.

CFLAGS and CXXFLAGS changes are both needed because bindgen is run on both .h and .hpp files for rusticl.

Quoted 17 lines
Quoted 7 lines
---
  ...w-build-option-for-extra-bindgen-inc.patch | 57 +++++++++++++++++++
  meta/recipes-graphics/mesa/mesa.inc           |  3 +-
  2 files changed, 59 insertions(+), 1 deletion(-)

create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-Add-a-new-build-option-for-extra-bindgen-inc.patch

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#218438): https://lists.openembedded.org/g/openembedded-core/message/218438
Mute This Topic: https://lists.openembedded.org/mt/113570520/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 11 lines · Böszörményi Zoltán

2025. 06. 10. 21:49 keltezéssel, Dmitry Baryshkov via lists.openembedded.org írta:

Quoted 10 lines · Zoltán Böszörményi
Quoted 9 lines

Add a patch to fix bindgen errors due to not finding headers in the system, like:

|...
| ../mesa-25.1.2/src/gallium/frontends/rusticl/ rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
| Unable to generate bindings: clang diagnosed error: ../mesa-25.1.2/ src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
|...
| .../work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/ glx.h:30:10: fatal error: 'X11/Xlib.h' file not found
| Unable to generate bindings: clang diagnosed error: /data2/dtd- yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/ include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found
Quoted 7 lines
Quoted 2 lines

Can we fix this on the meson side by passing additional include path through the cross file?

This seems to work in mesa.inc without patching Mesa:

CFLAGS:append:class-target = " -I${STAGING_INCDIR}" CXXFLAGS:append:class-target = " -I${STAGING_INCDIR}"

My question was more about meson.bbclass, where we set bindgen_clang_args. See the bindgen_args() function.

Quoted 33 lines

but it also[1] prints this for some of the bindgen runs:

clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:95:11: warning: '__INT64_C' macro redefined [-Wmacro-redefined] clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:96:11: warning: '__UINT64_C' macro redefined [-Wmacro-redefined]

[1] Using the previously posted patch also prints the same.

It seems to be caused by a meson bug because it doesn't collect the -isystem or --sysroot flags for rust/bindgen. See the discussion at the MR link in the patch.

CFLAGS and CXXFLAGS changes are both needed because bindgen is run on both .h and .hpp files for rusticl.

Quoted 17 lines
Quoted 7 lines

---
  ...w-build-option-for-extra-bindgen-inc.patch | 57 +++++++++++++++++++ meta/recipes-graphics/mesa/mesa.inc           |  3 +-

  2 files changed, 59 insertions(+), 1 deletion(-)

  create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl- Add-a-new-build-option-for-extra-bindgen-inc.patch

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#218438): https://lists.openembedded.org/g/ openembedded-core/message/218438 Mute This Topic: https://lists.openembedded.org/mt/113570520/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

2025. 06. 11. 19:34 keltezéssel, Dmitry Baryshkov írta:

Quoted 15 lines · Böszörményi Zoltán
Quoted 14 lines

2025. 06. 10. 21:49 keltezéssel, Dmitry Baryshkov via lists.openembedded.org írta:

Quoted 12 lines · Zoltán Böszörményi
Quoted 9 lines

Add a patch to fix bindgen errors due to not finding headers in the system, like:

|...
| ../mesa-25.1.2/src/gallium/frontends/rusticl/ rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
| Unable to generate bindings: clang diagnosed error: ../mesa-25.1.2/ src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error: 'clang/Basic/Version.h' file not found
|...
| .../work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/ glx.h:30:10: fatal error: 'X11/Xlib.h' file not found
| Unable to generate bindings: clang diagnosed error: /data2/dtd- yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/ include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found

Can we fix this on the meson side by passing additional include path through the cross file?

Quoted 6 lines
Quoted 4 lines

This seems to work in mesa.inc without patching Mesa:

CFLAGS:append:class-target = " -I${STAGING_INCDIR}" CXXFLAGS:append:class-target = " -I${STAGING_INCDIR}"

My question was more about meson.bbclass, where we set bindgen_clang_args. See the bindgen_args() function.

I wouldn't change meson.bbclass because it works for the most recipes already.

Besides, it seems to be a meson bug, not a meson.bbclass bug as -isystem and other include path related flags (besides -I) are ignored in CFLAGS/CXXFLAGS.

The "clang diag" messages are likely coming from mixed up host vs target header paths.

See
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435#note_2952621
https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/rust.py#L392-L397

If we changed meson.bbclass to add -I${STAGING_INCDIR} to the proper places in meson.cross, it would still print the clang diag warning. Adding -isystem would still get ignored.

FWIW, --sysroot is also ignored by meson and adding it forcibly throws a different error. See
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435#note_2952805

¯\_(ツ)_/¯

Quoted 34 lines
Quoted 32 lines

but it also[1] prints this for some of the bindgen runs:

clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:95:11: warning: '__INT64_C' macro redefined [-Wmacro-redefined] clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:96:11: warning: '__UINT64_C' macro redefined [-Wmacro-redefined]

[1] Using the previously posted patch also prints the same.

It seems to be caused by a meson bug because it doesn't collect the -isystem or --sysroot flags for rust/bindgen. See the discussion at the MR link in the patch.

CFLAGS and CXXFLAGS changes are both needed because bindgen is run on both .h and .hpp files for rusticl.

Quoted 17 lines
Quoted 7 lines

---
  ...w-build-option-for-extra-bindgen-inc.patch | 57 +++++++++++++++++++ meta/recipes-graphics/mesa/mesa.inc           |  3 +-

  2 files changed, 59 insertions(+), 1 deletion(-)

  create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl- Add-a-new-build-option-for-extra-bindgen-inc.patch

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#218438): https://lists.openembedded.org/g/ openembedded-core/message/218438 Mute This Topic: https://lists.openembedded.org/mt/113570520/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw
Quoted 25 lines · Böszörményi Zoltán

2025. 06. 11. 19:34 keltezéssel, Dmitry Baryshkov írta:

Quoted 23 lines · Böszörményi Zoltán
Quoted 22 lines

2025. 06. 10. 21:49 keltezéssel, Dmitry Baryshkov via lists.openembedded.org írta:

Quoted 16 lines · Zoltán Böszörményi
Quoted 15 lines

Add a patch to fix bindgen errors due to not finding headers in the system, like:

|...
| ../mesa-25.1.2/src/gallium/frontends/rusticl/ rusticl_llvm_bindings.hpp:1:10: fatal
error: 'clang/Basic/Version.h' file not found
| Unable to generate bindings: clang diagnosed error: ../mesa-25.1.2/ src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error:
'clang/Basic/Version.h' file not found
|...
| .../work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/ glx.h:30:10:
fatal error: 'X11/Xlib.h' file not found
| Unable to generate bindings: clang diagnosed error: /data2/dtd- yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/ include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found

Quoted 2 lines

Can we fix this on the meson side by passing additional include path through the cross file?

This seems to work in mesa.inc without patching Mesa:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

CFLAGS:append:class-target = " -I${STAGING_INCDIR}" CXXFLAGS:append:class-target = " -I${STAGING_INCDIR}"

My question was more about meson.bbclass, where we set bindgen_clang_args. See the bindgen_args() function.

I wouldn't change meson.bbclass because it works for the most recipes already.

The bindgen_args was implemented for mesa as the first user. It is not frequent for the packaged software to use rust.bindgen.

Quoted 8 lines

Besides, it seems to be a meson bug, not a meson.bbclass bug as -isystem and other include path related flags (besides -I) are ignored in CFLAGS/CXXFLAGS.

The "clang diag" messages are likely coming from mixed up host vs target header paths.

Quoted 7 lines

See
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435#note_2952621
https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/rust.py#L392-L397

If we changed meson.bbclass to add -I${STAGING_INCDIR} to the proper places in meson.cross, it would still print the clang diag warning. Adding -isystem would still get ignored.

Are we ta

Quoted 4 lines

FWIW, --sysroot is also ignored by meson and adding it forcibly throws a different error. See
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435#note_2952805

How were you passing it? Via CFLAGS / CPPFLAGS or via bindgen args?

Quoted 44 lines

¯\_(ツ)_/¯

Quoted 40 lines
Quoted 38 lines

but it also[1] prints this for some of the bindgen runs:

clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:95:11: warning: '__INT64_C' macro redefined [-Wmacro-redefined]
clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:96:11: warning: '__UINT64_C' macro redefined [-Wmacro-redefined]

[1] Using the previously posted patch also prints the same.

It seems to be caused by a meson bug because it doesn't collect the -isystem or --sysroot flags for rust/bindgen. See the discussion at the MR link in the patch.

CFLAGS and CXXFLAGS changes are both needed because bindgen is run on both .h and .hpp files for rusticl.

Quoted 19 lines
Quoted 8 lines
---
  ...w-build-option-for-extra-bindgen-inc.patch | 57 +++++++++++++++++++
  meta/recipes-graphics/mesa/mesa.inc           |  3 +-
  2 files changed, 59 insertions(+), 1 deletion(-)

create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-
Add-a-new-build-option-for-extra-bindgen-inc.patch

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#218438): https://lists.openembedded.org/g/
openembedded-core/message/218438
Mute This Topic: https://lists.openembedded.org/mt/113570520/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 2 lines
With best wishes
Dmitry
#6 lore raw

2025. 06. 11. 21:32 keltezéssel, Dmitry Baryshkov írta:

Quoted 40 lines · Böszörményi Zoltán
Quoted 21 lines

2025. 06. 11. 19:34 keltezéssel, Dmitry Baryshkov írta:

Quoted 20 lines · Böszörményi Zoltán
Quoted 19 lines

2025. 06. 10. 21:49 keltezéssel, Dmitry Baryshkov via lists.openembedded.org írta:

Quoted 18 lines · Zoltán Böszörményi
Quoted 15 lines

Add a patch to fix bindgen errors due to not finding headers in the system, like:

|...
| ../mesa-25.1.2/src/gallium/frontends/rusticl/ rusticl_llvm_bindings.hpp:1:10: fatal
error: 'clang/Basic/Version.h' file not found
| Unable to generate bindings: clang diagnosed error: ../mesa-25.1.2/ src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error:
'clang/Basic/Version.h' file not found
|...
| .../work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./GL/ glx.h:30:10:
fatal error: 'X11/Xlib.h' file not found
| Unable to generate bindings: clang diagnosed error: /data2/dtd- yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/ include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found

Can we fix this on the meson side by passing additional include path through the cross file?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This seems to work in mesa.inc without patching Mesa:

CFLAGS:append:class-target = " -I${STAGING_INCDIR}" CXXFLAGS:append:class-target = " -I${STAGING_INCDIR}"

My question was more about meson.bbclass, where we set bindgen_clang_args. See the bindgen_args() function.

I wouldn't change meson.bbclass because it works for the most recipes already.

The bindgen_args was implemented for mesa as the first user. It is not frequent for the packaged software to use rust.bindgen.

Quoted 7 lines

Besides, it seems to be a meson bug, not a meson.bbclass bug as -isystem and other include path related flags (besides -I) are ignored in CFLAGS/CXXFLAGS.

The "clang diag" messages are likely coming from mixed up host vs target header paths.

Quoted 8 lines
Quoted 7 lines

See
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435#note_2952621
https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/rust.py#L392-L397

If we changed meson.bbclass to add -I${STAGING_INCDIR} to the proper places in meson.cross, it would still print the clang diag warning. Adding -isystem would still get ignored.

Are we ta

???

Quoted 4 lines
Quoted 3 lines

FWIW, --sysroot is also ignored by meson and adding it forcibly throws a different error. See
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435#note_2952805

How were you passing it? Via CFLAGS / CPPFLAGS or via bindgen args?

Using  this patch and -Dbindgen-sysroot=${STAGING_DIR_TARGET}
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435/diffs?commit_id=a82381aeaba32775db51080b823893e4b6f647fb

--sysroot is not passing through to bindgen from CFLAGS/CXXFLAGS due to the filtering of flags in meson by the already qouted code piece at
https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/rust.py#L392-L397

Quoted 40 lines
Quoted 39 lines

¯\_(ツ)_/¯

Quoted 37 lines
Quoted 36 lines

but it also[1] prints this for some of the bindgen runs:

clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:95:11: warning: '__INT64_C' macro redefined [-Wmacro-redefined]
clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:96:11: warning: '__UINT64_C' macro redefined [-Wmacro-redefined]

[1] Using the previously posted patch also prints the same.

It seems to be caused by a meson bug because it doesn't collect the -isystem or --sysroot flags for rust/bindgen. See the discussion at the MR link in the patch.

CFLAGS and CXXFLAGS changes are both needed because bindgen is run on both .h and .hpp files for rusticl.

Quoted 18 lines
Quoted 8 lines
---
   ...w-build-option-for-extra-bindgen-inc.patch | 57 +++++++++++++++++++
   meta/recipes-graphics/mesa/mesa.inc           |  3 +-
   2 files changed, 59 insertions(+), 1 deletion(-)

create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-
Add-a-new-build-option-for-extra-bindgen-inc.patch

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#218438): https://lists.openembedded.org/g/
openembedded-core/message/218438
Mute This Topic: https://lists.openembedded.org/mt/113570520/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#7 lore raw
Quoted 55 lines · Böszörményi Zoltán

2025. 06. 11. 21:32 keltezéssel, Dmitry Baryshkov írta:

Quoted 40 lines · Böszörményi Zoltán
Quoted 21 lines

2025. 06. 11. 19:34 keltezéssel, Dmitry Baryshkov írta:

Quoted 20 lines · Böszörményi Zoltán
Quoted 19 lines

2025. 06. 10. 21:49 keltezéssel, Dmitry Baryshkov via lists.openembedded.org írta:

Quoted 18 lines · Zoltán Böszörményi
Quoted 15 lines

Add a patch to fix bindgen errors due to not finding headers in the system, like:

|...
| ../mesa-25.1.2/src/gallium/frontends/rusticl/ rusticl_llvm_bindings.hpp:1:10: fatal
error: 'clang/Basic/Version.h' file not found
| Unable to generate bindings: clang diagnosed error: ../ mesa-25.1.2/ src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error:
'clang/Basic/Version.h' file not found
|...
| .../work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./ GL/ glx.h:30:10:
fatal error: 'X11/Xlib.h' file not found
| Unable to generate bindings: clang diagnosed error: /data2/dtd- yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/ include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found

Can we fix this on the meson side by passing additional include path through the cross file?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This seems to work in mesa.inc without patching Mesa:

CFLAGS:append:class-target = " -I${STAGING_INCDIR}" CXXFLAGS:append:class-target = " -I${STAGING_INCDIR}"

My question was more about meson.bbclass, where we set bindgen_clang_args. See the bindgen_args() function.

I wouldn't change meson.bbclass because it works for the most recipes already.

The bindgen_args was implemented for mesa as the first user. It is not frequent for the packaged software to use rust.bindgen.

Quoted 7 lines

Besides, it seems to be a meson bug, not a meson.bbclass bug as -isystem and other include path related flags (besides -I) are ignored in CFLAGS/CXXFLAGS.

The "clang diag" messages are likely coming from mixed up host vs target header paths.

Quoted 8 lines
Quoted 7 lines

See
https://gitlab.freedesktop.org/mesa/mesa/-/ merge_requests/35435#note_2952621
https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/ rust.py#L392-L397

If we changed meson.bbclass to add -I${STAGING_INCDIR} to the proper places in meson.cross, it would still print the clang diag warning. Adding -isystem would still get ignored.

Are we ta

???

Quoted 3 lines
Quoted 3 lines

FWIW, --sysroot is also ignored by meson and adding it forcibly throws a different error. See
https://gitlab.freedesktop.org/mesa/mesa/-/ merge_requests/35435#note_2952805

Quoted 8 lines
Quoted 1 line

How were you passing it? Via CFLAGS / CPPFLAGS or via bindgen args?

Using  this patch and -Dbindgen-sysroot=${STAGING_DIR_TARGET}
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435/diffs? commit_id=a82381aeaba32775db51080b823893e4b6f647fb

--sysroot is not passing through to bindgen from CFLAGS/CXXFLAGS
due to the filtering of flags in meson by the already qouted code piece at
https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/ rust.py#L392-L397

Can we pass those flags via bindgen_clang_args? If I understand correctly, then they will bypass all the filtering.

Quoted 43 lines
Quoted 42 lines
Quoted 41 lines

¯\_(ツ)_/¯

Quoted 38 lines
Quoted 37 lines

but it also[1] prints this for some of the bindgen runs:

clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:95:11: warning: '__INT64_C' macro redefined [-Wmacro-redefined]
clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:96:11: warning: '__UINT64_C' macro redefined [-Wmacro-redefined]

[1] Using the previously posted patch also prints the same.

It seems to be caused by a meson bug because it doesn't collect the -isystem or --sysroot flags for rust/bindgen. See the discussion at the MR link in the patch.

CFLAGS and CXXFLAGS changes are both needed because bindgen is run on both .h and .hpp files for rusticl.

Quoted 19 lines
Quoted 9 lines

---
   ...w-build-option-for-extra-bindgen-inc.patch | 57 +++++++++++
++++++++
   meta/recipes-graphics/mesa/mesa.inc           |  3 +-

   2 files changed, 59 insertions(+), 1 deletion(-)

   create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl- Add-a-new-build-option-for-extra-bindgen-inc.patch

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#218438): https://lists.openembedded.org/g/
openembedded-core/message/218438
Mute This Topic: https://lists.openembedded.org/mt/113570520/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/ unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 2 lines
With best wishes
Dmitry
#8 lore raw

2025. 06. 12. 10:08 keltezéssel, Dmitry Baryshkov írta:

Quoted 58 lines · Böszörményi Zoltán
Quoted 57 lines

2025. 06. 11. 21:32 keltezéssel, Dmitry Baryshkov írta:

Quoted 40 lines · Böszörményi Zoltán
Quoted 21 lines

2025. 06. 11. 19:34 keltezéssel, Dmitry Baryshkov írta:

Quoted 20 lines · Böszörményi Zoltán
Quoted 19 lines

2025. 06. 10. 21:49 keltezéssel, Dmitry Baryshkov via lists.openembedded.org írta:

Quoted 18 lines · Zoltán Böszörményi
Quoted 15 lines

Add a patch to fix bindgen errors due to not finding headers in the system, like:

|...
| ../mesa-25.1.2/src/gallium/frontends/rusticl/ rusticl_llvm_bindings.hpp:1:10: fatal
error: 'clang/Basic/Version.h' file not found
| Unable to generate bindings: clang diagnosed error: ../ mesa-25.1.2/ src/gallium/frontends/rusticl/rusticl_llvm_bindings.hpp:1:10: fatal error:
'clang/Basic/Version.h' file not found
|...
| .../work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/include/./ GL/ glx.h:30:10:
fatal error: 'X11/Xlib.h' file not found
| Unable to generate bindings: clang diagnosed error: /data2/dtd- yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/mesa/25.1.2/mesa-25.1.2/ include/./GL/glx.h:30:10: fatal error: 'X11/Xlib.h' file not found

Can we fix this on the meson side by passing additional include path through the cross file?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

This seems to work in mesa.inc without patching Mesa:

CFLAGS:append:class-target = " -I${STAGING_INCDIR}" CXXFLAGS:append:class-target = " -I${STAGING_INCDIR}"

My question was more about meson.bbclass, where we set bindgen_clang_args. See the bindgen_args() function.

I wouldn't change meson.bbclass because it works for the most recipes already.

The bindgen_args was implemented for mesa as the first user. It is not frequent for the packaged software to use rust.bindgen.

Quoted 7 lines

Besides, it seems to be a meson bug, not a meson.bbclass bug as -isystem and other include path related flags (besides -I) are ignored in CFLAGS/CXXFLAGS.

The "clang diag" messages are likely coming from mixed up host vs target header paths.

Quoted 8 lines
Quoted 7 lines

See
https://gitlab.freedesktop.org/mesa/mesa/-/ merge_requests/35435#note_2952621
https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/ rust.py#L392-L397

If we changed meson.bbclass to add -I${STAGING_INCDIR} to the proper places in meson.cross, it would still print the clang diag warning. Adding -isystem would still get ignored.

Are we ta

???

Quoted 4 lines
Quoted 3 lines

FWIW, --sysroot is also ignored by meson and adding it forcibly throws a different error. See
https://gitlab.freedesktop.org/mesa/mesa/-/ merge_requests/35435#note_2952805

How were you passing it? Via CFLAGS / CPPFLAGS or via bindgen args?

Quoted 8 lines
Quoted 6 lines

Using  this patch and -Dbindgen-sysroot=${STAGING_DIR_TARGET}
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35435/diffs? commit_id=a82381aeaba32775db51080b823893e4b6f647fb

--sysroot is not passing through to bindgen from CFLAGS/CXXFLAGS
due to the filtering of flags in meson by the already qouted code piece at
https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/ rust.py#L392-L397

Can we pass those flags via bindgen_clang_args? If I understand correctly, then they will bypass all the filtering.

You mean these changes from master?

commit 40008d55c01681c60088e5b7defb0b8513a4ed1c
Author: Dmitry Baryshkov <[email protected]> Date:   Fri Apr 18 03:57:12 2025 +0300

    meson: pass -target and -I to bindgen calls

    In order to properly generate Rust bindings for the target systems, we need to pass '-taget foo-linux-gnueabi' flags and a correct include target include path (${STAGING_INCDIR}) to the bindgen. Add those flags to the generated meson target file.

and

commit a647a0ff4c4eb7a7c1f6ec84a574f7d7796b6178
Author: Dmitry Baryshkov <[email protected]> Date:   Mon May 5 19:22:30 2025 -0700

    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.

Hurray, they help building the backported mesa recipe on Yocto 5.2.

These two commits should be backported to walnascar. Pretty please.

Quoted 45 lines
Quoted 43 lines
Quoted 42 lines
Quoted 41 lines

¯\_(ツ)_/¯

Quoted 37 lines
Quoted 36 lines

but it also[1] prints this for some of the bindgen runs:

clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:95:11: warning: '__INT64_C' macro redefined [-Wmacro-redefined]
clang diag: /home/zozo/yocto-5.2/tmp-sicom/work/corei7-64-oe-linux/ mesa/25.1.3/recipe-sysroot/usr/include/stdint.h:96:11: warning: '__UINT64_C' macro redefined [-Wmacro-redefined]

[1] Using the previously posted patch also prints the same.

It seems to be caused by a meson bug because it doesn't collect the -isystem or --sysroot flags for rust/bindgen. See the discussion at the MR link in the patch.

CFLAGS and CXXFLAGS changes are both needed because bindgen is run on both .h and .hpp files for rusticl.

Quoted 18 lines
Quoted 8 lines

---
   ...w-build-option-for-extra-bindgen-inc.patch | 57 +++++++++++ ++++++++ meta/recipes-graphics/mesa/mesa.inc           | 3 +-

   2 files changed, 59 insertions(+), 1 deletion(-)

   create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl- Add-a-new-build-option-for-extra-bindgen-inc.patch

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#218438): https://lists.openembedded.org/g/
openembedded-core/message/218438
Mute This Topic: https://lists.openembedded.org/mt/113570520/3617728
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/ unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-