diff mbox series

[2/7] meson: pass -target and -I to bindgen calls

Message ID 20250412-mesa-25-fixes-v1-2-791840391271@oss.qualcomm.com
State Under Review
Headers show
Series mesa: small improvements after 25.0 merge | expand

Commit Message

Dmitry Baryshkov April 11, 2025, 10:09 p.m. UTC
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.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 meta/classes-recipe/meson.bbclass | 1 +
 1 file changed, 1 insertion(+)

Comments

Khem Raj April 11, 2025, 10:53 p.m. UTC | #1
On Fri, Apr 11, 2025 at 3:09 PM Dmitry Baryshkov via
lists.openembedded.org
<dmitry.baryshkov=oss.qualcomm.com@lists.openembedded.org> wrote:
>
> 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.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>  meta/classes-recipe/meson.bbclass | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass
> index cbfc45b94bbd076735847134a0976b6b30784d50..ef45a034a767e979a45553ba08e46dc90e34f33f 100644
> --- a/meta/classes-recipe/meson.bbclass
> +++ b/meta/classes-recipe/meson.bbclass
> @@ -93,6 +93,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}']

I think its better to use ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}
--target=${TARGET_SYS}
here

>
>  [host_machine]
>  system = '${@meson_operating_system('HOST_OS', d)}'
>
> --
> 2.39.5
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#214764): https://lists.openembedded.org/g/openembedded-core/message/214764
> Mute This Topic: https://lists.openembedded.org/mt/112219030/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Dmitry Baryshkov April 12, 2025, 3:50 p.m. UTC | #2
On 12/04/2025 01:53, Khem Raj wrote:
> On Fri, Apr 11, 2025 at 3:09 PM Dmitry Baryshkov via
> lists.openembedded.org
> <dmitry.baryshkov=oss.qualcomm.com@lists.openembedded.org> wrote:
>>
>> 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.
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>> ---
>>   meta/classes-recipe/meson.bbclass | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass
>> index cbfc45b94bbd076735847134a0976b6b30784d50..ef45a034a767e979a45553ba08e46dc90e34f33f 100644
>> --- a/meta/classes-recipe/meson.bbclass
>> +++ b/meta/classes-recipe/meson.bbclass
>> @@ -93,6 +93,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}']
> 
> I think its better to use ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}
> --target=${TARGET_SYS}

TARGET_SYS doesn't work, as it doesn't include 'hf' on ARM, etc.
For v2 I'll use ${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} 
--target=${RUST_HOST_SYS}

> here
> 
>>
>>   [host_machine]
>>   system = '${@meson_operating_system('HOST_OS', d)}'
>>
>> --
>> 2.39.5
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#214764): https://lists.openembedded.org/g/openembedded-core/message/214764
>> Mute This Topic: https://lists.openembedded.org/mt/112219030/1997914
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
Dmitry Baryshkov April 12, 2025, 4:29 p.m. UTC | #3
On 12/04/2025 01:53, Khem Raj wrote:
> On Fri, Apr 11, 2025 at 3:09 PM Dmitry Baryshkov via
> lists.openembedded.org
> <dmitry.baryshkov=oss.qualcomm.com@lists.openembedded.org> wrote:
>>
>> 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.
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>> ---
>>   meta/classes-recipe/meson.bbclass | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass
>> index cbfc45b94bbd076735847134a0976b6b30784d50..ef45a034a767e979a45553ba08e46dc90e34f33f 100644
>> --- a/meta/classes-recipe/meson.bbclass
>> +++ b/meta/classes-recipe/meson.bbclass
>> @@ -93,6 +93,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}']
> 
> I think its better to use ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}
> --target=${TARGET_SYS}

Using ${TOOLCHAIN_OPTIONS} breaks x86-64 build with the compiler being 
unable to find headers. I'd rather stick to the patch I have posted.

> here
> 
>>
>>   [host_machine]
>>   system = '${@meson_operating_system('HOST_OS', d)}'
>>
>> --
>> 2.39.5
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#214764): https://lists.openembedded.org/g/openembedded-core/message/214764
>> Mute This Topic: https://lists.openembedded.org/mt/112219030/1997914
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
Khem Raj April 12, 2025, 6:02 p.m. UTC | #4
On Sat, Apr 12, 2025 at 9:29 AM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> On 12/04/2025 01:53, Khem Raj wrote:
> > On Fri, Apr 11, 2025 at 3:09 PM Dmitry Baryshkov via
> > lists.openembedded.org
> > <dmitry.baryshkov=oss.qualcomm.com@lists.openembedded.org> wrote:
> >>
> >> 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.
> >>
> >> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> >> ---
> >>   meta/classes-recipe/meson.bbclass | 1 +
> >>   1 file changed, 1 insertion(+)
> >>
> >> diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass
> >> index cbfc45b94bbd076735847134a0976b6b30784d50..ef45a034a767e979a45553ba08e46dc90e34f33f 100644
> >> --- a/meta/classes-recipe/meson.bbclass
> >> +++ b/meta/classes-recipe/meson.bbclass
> >> @@ -93,6 +93,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}']
> >
> > I think its better to use ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}
> > --target=${TARGET_SYS}
>
> Using ${TOOLCHAIN_OPTIONS} breaks x86-64 build with the compiler being
> unable to find headers. I'd rather stick to the patch I have posted.

You have to use ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} and --target=${TARGET_SYS}
together, OE's compilers do not deal with 'hf' from target tuple but
TOOLCHAIN_OPTIONS decide
the ABI, please try both of them together.
>
> > here
> >
> >>
> >>   [host_machine]
> >>   system = '${@meson_operating_system('HOST_OS', d)}'
> >>
> >> --
> >> 2.39.5
> >>
> >>
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >> Links: You receive all messages sent to this group.
> >> View/Reply Online (#214764): https://lists.openembedded.org/g/openembedded-core/message/214764
> >> Mute This Topic: https://lists.openembedded.org/mt/112219030/1997914
> >> Group Owner: openembedded-core+owner@lists.openembedded.org
> >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >>
>
>
> --
> With best wishes
> Dmitry
diff mbox series

Patch

diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass
index cbfc45b94bbd076735847134a0976b6b30784d50..ef45a034a767e979a45553ba08e46dc90e34f33f 100644
--- a/meta/classes-recipe/meson.bbclass
+++ b/meta/classes-recipe/meson.bbclass
@@ -93,6 +93,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}']
 
 [host_machine]
 system = '${@meson_operating_system('HOST_OS', d)}'