diff mbox series

[v6,3/6] mesa: Pass needed clang flags via BINDGEN_EXTRA_CLANG_ARGS

Message ID 20250502-clang-merge-v6-3-00f2c2e9ff68@gmail.com
State New
Headers show
Series clang-merge: Bring clang recipes from meta-clang | expand

Commit Message

Khem Raj May 2, 2025, 4:55 p.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 May 2, 2025, 8:19 p.m. UTC | #1
On Fri, May 02, 2025 at 09:55:17AM -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(+)

I still think that the attached patch is a proper solution.
Khem Raj May 2, 2025, 8:22 p.m. UTC | #2
On Fri, May 2, 2025 at 1:19 PM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> On Fri, May 02, 2025 at 09:55:17AM -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(+)
>
> I still think that the attached patch is a proper solution.

I have apprehensions about doing it meson wide, while the need is just
for mesa and mesa
happens to use meson, its not other way around. So tooling a solution
for all meson packages
is sub-optimal here, unless we start getting many other meson packages
needing bindgen
I hope you understand.

>
> --
> With best wishes
> Dmitry
Dmitry Baryshkov May 2, 2025, 8:38 p.m. UTC | #3
On 02/05/2025 23:22, Khem Raj wrote:
> On Fri, May 2, 2025 at 1:19 PM Dmitry Baryshkov
> <dmitry.baryshkov@oss.qualcomm.com> wrote:
>>
>> On Fri, May 02, 2025 at 09:55:17AM -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(+)
>>
>> I still think that the attached patch is a proper solution.
> 
> I have apprehensions about doing it meson wide, while the need is just
> for mesa and mesa
> happens to use meson, its not other way around. So tooling a solution
> for all meson packages
> is sub-optimal here, unless we start getting many other meson packages
> needing bindgen
> I hope you understand.

Ack. Then could you please extend the patch by dropping corresponding 
setting from meson.bbclass? I don't think we should utilize both ways to 
set bindgen args at the same time.

> 
>>
>> --
>> 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*