diff mbox series

[v4,08/10] mesa: Pass needed clang flags via BINDGEN_EXTRA_CLANG_ARGS

Message ID 20250426-clang-merge-v4-8-42d205904261@gmail.com
State Accepted, archived
Commit 6d9f95a25dd32871e8c07ec3295a216236b3a7e0
Headers show
Series clang-merge: Bring clang recipes from meta-clang | expand

Commit Message

Khem Raj April 27, 2025, 3:16 a.m. UTC
This is needed for clang to find the c++ headers when invoked via
bindgen

Fixes
| /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
| Unable to generate bindings: clang diagnosed error: /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
|

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 meta/recipes-graphics/mesa/mesa.inc | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Dmitry Baryshkov April 28, 2025, 11:03 a.m. UTC | #1
On Sat, Apr 26, 2025 at 08:16:47PM -0700, Khem Raj wrote:
> This is needed for clang to find the c++ headers when invoked via
> bindgen
> 
> Fixes
> | /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> | Unable to generate bindings: clang diagnosed error: /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> |
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>  meta/recipes-graphics/mesa/mesa.inc | 4 ++++
>  1 file changed, 4 insertions(+)

This way we have two sets of bindgen/clang args: one added by
meson.bbclass, one specific for mesa which you patch up here. Please
pick up the attached patch instead, it makes sure that there is only one
place to specify bindgen args for Clang and documents the reason for SDK
packages requiring special handling.
Khem Raj April 28, 2025, 2:50 p.m. UTC | #2
On Mon, Apr 28, 2025 at 4:03 AM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> On Sat, Apr 26, 2025 at 08:16:47PM -0700, Khem Raj wrote:
> > This is needed for clang to find the c++ headers when invoked via
> > bindgen
> >
> > Fixes
> > | /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > | Unable to generate bindings: clang diagnosed error: /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > |
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > ---
> >  meta/recipes-graphics/mesa/mesa.inc | 4 ++++
> >  1 file changed, 4 insertions(+)
>
> This way we have two sets of bindgen/clang args: one added by
> meson.bbclass, one specific for mesa which you patch up here. Please
> pick up the attached patch instead, it makes sure that there is only one
> place to specify bindgen args for Clang and documents the reason for SDK
> packages requiring special handling.

This is breaking mesa-native recipe. Why is bindgen invocation special
for meson? we have other recipes in
e.g. meta-openembedded which pass this variable from recipes and have
finer control over
recipe types that way

>
> --
> With best wishes
> Dmitry
Dmitry Baryshkov April 28, 2025, 2:56 p.m. UTC | #3
On Mon, 28 Apr 2025 at 17:51, Khem Raj <raj.khem@gmail.com> wrote:
>
> On Mon, Apr 28, 2025 at 4:03 AM Dmitry Baryshkov
> <dmitry.baryshkov@oss.qualcomm.com> wrote:
> >
> > On Sat, Apr 26, 2025 at 08:16:47PM -0700, Khem Raj wrote:
> > > This is needed for clang to find the c++ headers when invoked via
> > > bindgen
> > >
> > > Fixes
> > > | /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > | Unable to generate bindings: clang diagnosed error: /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > |
> > >
> > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > > ---
> > >  meta/recipes-graphics/mesa/mesa.inc | 4 ++++
> > >  1 file changed, 4 insertions(+)
> >
> > This way we have two sets of bindgen/clang args: one added by
> > meson.bbclass, one specific for mesa which you patch up here. Please
> > pick up the attached patch instead, it makes sure that there is only one
> > place to specify bindgen args for Clang and documents the reason for SDK
> > packages requiring special handling.
>
> This is breaking mesa-native recipe. Why is bindgen invocation special
> for meson? we have other recipes in
> e.g. meta-openembedded which pass this variable from recipes and have
> finer control over
> recipe types that way

mesa-native worked for me, what is your build configuration?

Putting necessary arguments to meson cross file was a recommendation
from Mesa developers. I think we should follow it instead of patching
environment variable in recipes.

>
> >
> > --
> > With best wishes
> > Dmitry
Khem Raj April 28, 2025, 5:09 p.m. UTC | #4
On Mon, Apr 28, 2025 at 7:56 AM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> On Mon, 28 Apr 2025 at 17:51, Khem Raj <raj.khem@gmail.com> wrote:
> >
> > On Mon, Apr 28, 2025 at 4:03 AM Dmitry Baryshkov
> > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> > >
> > > On Sat, Apr 26, 2025 at 08:16:47PM -0700, Khem Raj wrote:
> > > > This is needed for clang to find the c++ headers when invoked via
> > > > bindgen
> > > >
> > > > Fixes
> > > > | /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > > | Unable to generate bindings: clang diagnosed error: /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > > |
> > > >
> > > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > > Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > > > ---
> > > >  meta/recipes-graphics/mesa/mesa.inc | 4 ++++
> > > >  1 file changed, 4 insertions(+)
> > >
> > > This way we have two sets of bindgen/clang args: one added by
> > > meson.bbclass, one specific for mesa which you patch up here. Please
> > > pick up the attached patch instead, it makes sure that there is only one
> > > place to specify bindgen args for Clang and documents the reason for SDK
> > > packages requiring special handling.
> >
> > This is breaking mesa-native recipe. Why is bindgen invocation special
> > for meson? we have other recipes in
> > e.g. meta-openembedded which pass this variable from recipes and have
> > finer control over
> > recipe types that way
>
> mesa-native worked for me, what is your build configuration?

I have this
PACKAGECONFIG:append:pn-mesa = " opencl libclc gallium-llvm "
PACKAGECONFIG:append:pn-mesa-native = " opencl libclc gallium-llvm "
PACKAGECONFIG:append:pn-nativesdk-mesa = " opencl libclc gallium-llvm "

and I am building for qemuarm64 on x86_64 host and sdkhost.

>
> Putting necessary arguments to meson cross file was a recommendation
> from Mesa developers. I think we should follow it instead of patching
> environment variable in recipes.

Is this recommendation from meson too ? I think no, so we will be
carry this locally moreover, meson
is uses to build more packages than mesa and adding mesa
recommendation for generic meson
might not be ideal.

>
> >
> > >
> > > --
> > > With best wishes
> > > Dmitry
>
>
>
> --
> With best wishes
> Dmitry
Dmitry Baryshkov April 28, 2025, 11:03 p.m. UTC | #5
On Mon, 28 Apr 2025 at 20:10, Khem Raj <raj.khem@gmail.com> wrote:
>
> On Mon, Apr 28, 2025 at 7:56 AM Dmitry Baryshkov
> <dmitry.baryshkov@oss.qualcomm.com> wrote:
> >
> > On Mon, 28 Apr 2025 at 17:51, Khem Raj <raj.khem@gmail.com> wrote:
> > >
> > > On Mon, Apr 28, 2025 at 4:03 AM Dmitry Baryshkov
> > > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> > > >
> > > > On Sat, Apr 26, 2025 at 08:16:47PM -0700, Khem Raj wrote:
> > > > > This is needed for clang to find the c++ headers when invoked via
> > > > > bindgen
> > > > >
> > > > > Fixes
> > > > > | /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > > > | Unable to generate bindings: clang diagnosed error: /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > > > |
> > > > >
> > > > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > > > Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > > > > ---
> > > > >  meta/recipes-graphics/mesa/mesa.inc | 4 ++++
> > > > >  1 file changed, 4 insertions(+)
> > > >
> > > > This way we have two sets of bindgen/clang args: one added by
> > > > meson.bbclass, one specific for mesa which you patch up here. Please
> > > > pick up the attached patch instead, it makes sure that there is only one
> > > > place to specify bindgen args for Clang and documents the reason for SDK
> > > > packages requiring special handling.
> > >
> > > This is breaking mesa-native recipe. Why is bindgen invocation special
> > > for meson? we have other recipes in
> > > e.g. meta-openembedded which pass this variable from recipes and have
> > > finer control over
> > > recipe types that way
> >
> > mesa-native worked for me, what is your build configuration?
>
> I have this
> PACKAGECONFIG:append:pn-mesa = " opencl libclc gallium-llvm "
> PACKAGECONFIG:append:pn-mesa-native = " opencl libclc gallium-llvm "
> PACKAGECONFIG:append:pn-nativesdk-mesa = " opencl libclc gallium-llvm "
>
> and I am building for qemuarm64 on x86_64 host and sdkhost.

Yes, this is my config too. I was building poky + these entries.
Anything distro-specific? Maybe a clang toolchain?

>
> >
> > Putting necessary arguments to meson cross file was a recommendation
> > from Mesa developers. I think we should follow it instead of patching
> > environment variable in recipes.
>
> Is this recommendation from meson too ? I think no, so we will be
> carry this locally moreover, meson
> is uses to build more packages than mesa and adding mesa
> recommendation for generic meson
> might not be ideal.

I'd say, it is a meson recommendation - they added an entry to the
cross file instead of making everybody use environment variable.
Khem Raj April 28, 2025, 11:33 p.m. UTC | #6
On Mon, Apr 28, 2025 at 4:03 PM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> On Mon, 28 Apr 2025 at 20:10, Khem Raj <raj.khem@gmail.com> wrote:
> >
> > On Mon, Apr 28, 2025 at 7:56 AM Dmitry Baryshkov
> > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> > >
> > > On Mon, 28 Apr 2025 at 17:51, Khem Raj <raj.khem@gmail.com> wrote:
> > > >
> > > > On Mon, Apr 28, 2025 at 4:03 AM Dmitry Baryshkov
> > > > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> > > > >
> > > > > On Sat, Apr 26, 2025 at 08:16:47PM -0700, Khem Raj wrote:
> > > > > > This is needed for clang to find the c++ headers when invoked via
> > > > > > bindgen
> > > > > >
> > > > > > Fixes
> > > > > > | /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > > > > | Unable to generate bindings: clang diagnosed error: /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > > > > |
> > > > > >
> > > > > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > > > > Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > > > > > ---
> > > > > >  meta/recipes-graphics/mesa/mesa.inc | 4 ++++
> > > > > >  1 file changed, 4 insertions(+)
> > > > >
> > > > > This way we have two sets of bindgen/clang args: one added by
> > > > > meson.bbclass, one specific for mesa which you patch up here. Please
> > > > > pick up the attached patch instead, it makes sure that there is only one
> > > > > place to specify bindgen args for Clang and documents the reason for SDK
> > > > > packages requiring special handling.
> > > >
> > > > This is breaking mesa-native recipe. Why is bindgen invocation special
> > > > for meson? we have other recipes in
> > > > e.g. meta-openembedded which pass this variable from recipes and have
> > > > finer control over
> > > > recipe types that way
> > >
> > > mesa-native worked for me, what is your build configuration?
> >
> > I have this
> > PACKAGECONFIG:append:pn-mesa = " opencl libclc gallium-llvm "
> > PACKAGECONFIG:append:pn-mesa-native = " opencl libclc gallium-llvm "
> > PACKAGECONFIG:append:pn-nativesdk-mesa = " opencl libclc gallium-llvm "
> >
> > and I am building for qemuarm64 on x86_64 host and sdkhost.
>
> Yes, this is my config too. I was building poky + these entries.
> Anything distro-specific? Maybe a clang toolchain?

No, I am using vanilla poky too. here is my local.conf
http://0x0.st/8W4V.conf



>
> >
> > >
> > > Putting necessary arguments to meson cross file was a recommendation
> > > from Mesa developers. I think we should follow it instead of patching
> > > environment variable in recipes.
> >
> > Is this recommendation from meson too ? I think no, so we will be
> > carry this locally moreover, meson
> > is uses to build more packages than mesa and adding mesa
> > recommendation for generic meson
> > might not be ideal.
>
> I'd say, it is a meson recommendation - they added an entry to the
> cross file instead of making everybody use environment variable.
>
>
> --
> With best wishes
> Dmitry
Dmitry Baryshkov April 29, 2025, 2:26 p.m. UTC | #7
On Mon, Apr 28, 2025 at 04:33:30PM -0700, Khem Raj wrote:
> On Mon, Apr 28, 2025 at 4:03 PM Dmitry Baryshkov
> <dmitry.baryshkov@oss.qualcomm.com> wrote:
> >
> > On Mon, 28 Apr 2025 at 20:10, Khem Raj <raj.khem@gmail.com> wrote:
> > >
> > > On Mon, Apr 28, 2025 at 7:56 AM Dmitry Baryshkov
> > > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> > > >
> > > > On Mon, 28 Apr 2025 at 17:51, Khem Raj <raj.khem@gmail.com> wrote:
> > > > >
> > > > > On Mon, Apr 28, 2025 at 4:03 AM Dmitry Baryshkov
> > > > > <dmitry.baryshkov@oss.qualcomm.com> wrote:
> > > > > >
> > > > > > On Sat, Apr 26, 2025 at 08:16:47PM -0700, Khem Raj wrote:
> > > > > > > This is needed for clang to find the c++ headers when invoked via
> > > > > > > bindgen
> > > > > > >
> > > > > > > Fixes
> > > > > > > | /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > > > > > | Unable to generate bindings: clang diagnosed error: /mnt/b/yoe/master/sources/poky/build/tmp/work/cortexa57-poky-linux/mesa/25.0.2/recipe-sysroot/usr/include/llvm/ADT/DenseMapInfo.h:17:10: fatal error: 'cassert' file not found
> > > > > > > |
> > > > > > >
> > > > > > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > > > > > Cc: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > > > > > > ---
> > > > > > >  meta/recipes-graphics/mesa/mesa.inc | 4 ++++
> > > > > > >  1 file changed, 4 insertions(+)
> > > > > >
> > > > > > This way we have two sets of bindgen/clang args: one added by
> > > > > > meson.bbclass, one specific for mesa which you patch up here. Please
> > > > > > pick up the attached patch instead, it makes sure that there is only one
> > > > > > place to specify bindgen args for Clang and documents the reason for SDK
> > > > > > packages requiring special handling.
> > > > >
> > > > > This is breaking mesa-native recipe. Why is bindgen invocation special
> > > > > for meson? we have other recipes in
> > > > > e.g. meta-openembedded which pass this variable from recipes and have
> > > > > finer control over
> > > > > recipe types that way
> > > >
> > > > mesa-native worked for me, what is your build configuration?
> > >
> > > I have this
> > > PACKAGECONFIG:append:pn-mesa = " opencl libclc gallium-llvm "
> > > PACKAGECONFIG:append:pn-mesa-native = " opencl libclc gallium-llvm "
> > > PACKAGECONFIG:append:pn-nativesdk-mesa = " opencl libclc gallium-llvm "
> > >
> > > and I am building for qemuarm64 on x86_64 host and sdkhost.
> >
> > Yes, this is my config too. I was building poky + these entries.
> > Anything distro-specific? Maybe a clang toolchain?
> 
> No, I am using vanilla poky too. here is my local.conf
> http://0x0.st/8W4V.conf

See the attached patch.

> 
> 
> 
> >
> > >
> > > >
> > > > Putting necessary arguments to meson cross file was a recommendation
> > > > from Mesa developers. I think we should follow it instead of patching
> > > > environment variable in recipes.
> > >
> > > Is this recommendation from meson too ? I think no, so we will be
> > > carry this locally moreover, meson
> > > is uses to build more packages than mesa and adding mesa
> > > recommendation for generic meson
> > > might not be ideal.
> >
> > I'd say, it is a meson recommendation - they added an entry to the
> > cross file instead of making everybody use environment variable.
> >
> >
> > --
> > With best wishes
> > Dmitry
>
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index cd0f02c6d7b7c8de37bdb1695abc70d95f99a919..c477b774628eb49dacae8b64244d3e98bfcc2588 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -266,6 +266,10 @@  PACKAGES =+ "libegl-mesa libegl-mesa-dev \
              mesa-vdpau-drivers mesa-tools \
             "
 
+do_compile:prepend:class-target() {
+    export BINDGEN_EXTRA_CLANG_ARGS="${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} --target=${TARGET_SYS}"
+}
+
 do_install:append () {
     # libwayland-egl has been moved to wayland 1.15+
     rm -f ${D}${libdir}/libwayland-egl*