diff mbox series

[4/4] mesa: Add PACKAGECONFIG "rusticl"

Message ID 20230224093850.3393567-4-zboszor@gmail.com
State New
Headers show
Series [1/4] bindgen-cli: Add new recipe | expand

Commit Message

Böszörményi Zoltán Feb. 24, 2023, 9:38 a.m. UTC
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 meta/recipes-graphics/mesa/mesa.inc | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

Comments

Ross Burton Feb. 24, 2023, 9:45 a.m. UTC | #1
> On 24 Feb 2023, at 09:38, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
> -inherit meson pkgconfig python3native gettext features_check
> +inherit meson pkgconfig python3native gettext features_check rust

This forces a dependency on rust-native, even if rusticl is disabled.

Is it actually needed? If so, make the inherit conditional.

Ross
Böszörményi Zoltán Feb. 24, 2023, 10:05 a.m. UTC | #2
2023. 02. 24. 10:45 keltezéssel, Ross Burton írta:
>> On 24 Feb 2023, at 09:38, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
>> -inherit meson pkgconfig python3native gettext features_check
>> +inherit meson pkgconfig python3native gettext features_check rust
> This forces a dependency on rust-native, even if rusticl is disabled.
>
> Is it actually needed? If so, make the inherit conditional.

I will do that, thanks.

>
> Ross
Böszörményi Zoltán Feb. 24, 2023, 10:34 a.m. UTC | #3
2023. 02. 24. 11:05 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
> 2023. 02. 24. 10:45 keltezéssel, Ross Burton írta:
>>> On 24 Feb 2023, at 09:38, Zoltan Boszormenyi via lists.openembedded.org 
>>> <zboszor=gmail.com@lists.openembedded.org> wrote:
>>> -inherit meson pkgconfig python3native gettext features_check
>>> +inherit meson pkgconfig python3native gettext features_check rust
>> This forces a dependency on rust-native, even if rusticl is disabled.
>>
>> Is it actually needed? If so, make the inherit conditional.
>
> I will do that, thanks.

Problem is, now the configure stage fails with:

| ../mesa-23.0.0/meson.build:964: WARNING: add_languages is missing native:, assuming 
languages are wanted for both host and build.
| Compiler for language rust for the build machine not found.
|
| ../mesa-23.0.0/meson.build:964:2: ERROR: Rust compiler rustc -C 
linker=x86_64-oe-linux-gcc -C link-arg=-m64 -C link-arg=-march=nehalem -C 
link-arg=-mtune=generic -C link-arg=-mfpmath=sse -C link-arg=-msse4.2 -C 
link-arg=-fstack-protector-strong -C link-arg=-O2 -C link-arg=-D_FORTIFY_SOURCE=2 -C 
link-arg=-Wformat -C link-arg=-Wformat-security -C link-arg=-Werror=format-security -C 
link-arg=--sysroot=/data2/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/mesa/2_23.0.0-r0/recipe-sysroot 
can not compile programs.
|
| error: Error loading target specification: Could not find specification for target 
"x86_64-linux". Run `rustc --print target-list` for a list of built-in targets

I also tried it with moving the conditionally set rust
between or before the already inherited classes.

It succeeds when inherit rust is not conditional.

>
>>
>> Ross
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#177672): https://lists.openembedded.org/g/openembedded-core/message/177672
> Mute This Topic: https://lists.openembedded.org/mt/97202946/3617728
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexander Kanavin Feb. 24, 2023, 10:52 a.m. UTC | #4
On Fri, 24 Feb 2023 at 11:34, Zoltan Boszormenyi <zboszor@gmail.com> wrote:
> Problem is, now the configure stage fails with:
>
> | ../mesa-23.0.0/meson.build:964: WARNING: add_languages is missing native:, assuming
> languages are wanted for both host and build.
> | Compiler for language rust for the build machine not found.
> |
> | ../mesa-23.0.0/meson.build:964:2: ERROR: Rust compiler rustc -C
> linker=x86_64-oe-linux-gcc -C link-arg=-m64 -C link-arg=-march=nehalem -C
> link-arg=-mtune=generic -C link-arg=-mfpmath=sse -C link-arg=-msse4.2 -C
> link-arg=-fstack-protector-strong -C link-arg=-O2 -C link-arg=-D_FORTIFY_SOURCE=2 -C
> link-arg=-Wformat -C link-arg=-Wformat-security -C link-arg=-Werror=format-security -C
> link-arg=--sysroot=/data2/dtd-yocto-4.0/tmp-sicom-glibc/work/corei7-64-oe-linux/mesa/2_23.0.0-r0/recipe-sysroot
> can not compile programs.
> |
> | error: Error loading target specification: Could not find specification for target
> "x86_64-linux". Run `rustc --print target-list` for a list of built-in targets
>
> I also tried it with moving the conditionally set rust
> between or before the already inherited classes.
>
> It succeeds when inherit rust is not conditional.

It also succeeds when there is no inherit rust at all, in the current
master branch recipe.

If inherit rust is conditional, and condition is false, then there is
some other change that triggers the failure, and that change should be
conditional as well.

Alex
Alexander Kanavin Feb. 24, 2023, 11:12 a.m. UTC | #5
On Fri, 24 Feb 2023 at 11:52, Alexander Kanavin via
lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
wrote:
> It also succeeds when there is no inherit rust at all, in the current
> master branch recipe.
>
> If inherit rust is conditional, and condition is false, then there is
> some other change that triggers the failure, and that change should be
> conditional as well.

Or is it the other way around - fails when condition should be true?
How did you write it?

Alex
Böszörményi Zoltán Feb. 24, 2023, 4:41 p.m. UTC | #6
2023. 02. 24. 12:12 keltezéssel, Alexander Kanavin írta:
> On Fri, 24 Feb 2023 at 11:52, Alexander Kanavin via
> lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
> wrote:
>> It also succeeds when there is no inherit rust at all, in the current
>> master branch recipe.
>>
>> If inherit rust is conditional, and condition is false, then there is
>> some other change that triggers the failure, and that change should be
>> conditional as well.
> Or is it the other way around - fails when condition should be true?
> How did you write it?

Copied from a different recipe and modified for this use case:

inherit ${@bb.utils.contains('PACKAGECONFIG', 'rusticl', 'rust', '', d)}


> Alex
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 9ec10c49ca..e70cf9a42a 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -45,7 +45,7 @@  PROVIDES = " \
     virtual/mesa \
     "
 
-inherit meson pkgconfig python3native gettext features_check
+inherit meson pkgconfig python3native gettext features_check rust
 
 BBCLASSEXTEND = "native nativesdk"
 
@@ -119,6 +119,13 @@  PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
 OPENCL_NATIVE = "${@bb.utils.contains('PACKAGECONFIG', 'freedreno', '-Dopencl-native=true', '', d)}"
 PACKAGECONFIG[clover] = "-Dgallium-opencl=icd -Dopencl-spirv=true ${OPENCL_NATIVE},-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc spirv-tools"
 
+# "rusticl" requires libclc and spirv-llvm-translator from meta-clang and spirv-tools from OE-Core
+PACKAGECONFIG[rusticl] = "-Dgallium-rusticl=true -Drust_std=2021,-Dgallium-rusticl=false,bindgen-cli-native libclc spirv-tools spirv-llvm-translator,libclc spirv-tools spirv-llvm-translator"
+
+# "rusticl" runs bindgen.
+# This setting is needed by bindgen to dlopen the correct libclang.
+export LIBCLANG_PATH = "${STAGING_LIBDIR_NATIVE}"
+
 PACKAGECONFIG[broadcom] = ""
 PACKAGECONFIG[etnaviv] = ""
 PACKAGECONFIG[freedreno] = ""
@@ -197,6 +204,7 @@  DEV_PKG_DEPENDENCY = ""
 RDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev"
 
 RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'clover', 'libclc spirv-tools', '', d)}"
+RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'rusticl', 'libclc spirv-tools spirv-llvm-translator', '', d)}"
 
 PACKAGES =+ "libegl-mesa libegl-mesa-dev \
              libosmesa libosmesa-dev \
@@ -242,7 +250,8 @@  python __anonymous() {
               ("gles", "libgles1", "libglesv1-cm1"),
               ("gles", "libgles2", "libglesv2-2"),
               ("gles", "libgles3",),
-              ("clover", "libopencl",)):
+              ("clover", "libopencl",),
+              ("rusticl", "libopencl",)):
         if not p[0] in pkgconfig:
             continue
         mlprefix = d.getVar("MLPREFIX")
@@ -303,7 +312,8 @@  FILES:libgles1-mesa = "${libdir}/libGLESv1*.so.*"
 FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*"
 FILES:libgl-mesa = "${libdir}/libGL.so.*"
 FILES:libglx-mesa = "${libdir}/libGLX*.so.*"
-FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd"
+FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/libRusticlOpenCL.so ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd ${sysconfdir}/OpenCL/vendors/rusticl.icd"
+INSANE_SKIP:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'rusticl', 'dev-so', '', d)}"
 FILES:libglapi = "${libdir}/libglapi.so.*"
 FILES:libosmesa = "${libdir}/libOSMesa.so.*"
 FILES:libxatracker = "${libdir}/libxatracker.so.*"