From ac5e0160df78eef03470daf1f70a5f4d2dc0bac1 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Fri, 6 Feb 2026 18:23:59 +0100 Subject: [PATCH] mesa: depend on mesa-tools-native for less expensive libclc dependency libclc is required for some drivers (asahi, panfrost and intel at the very least). libclc brings very expensive per-target dependencies such as llvm and clang. However, we can make libclc depend on native tools (mesa-clc and precomp-compiler via mesa-tools-native) such that this cost exists only once (for the native build machine) and not for each machine to build. So this migrates the libclc dependency to make use of the newly introduced mesa-tools-native to make use of mesa-clc=system and precomp-compiler=system. We told the user to have libclc PACKAGECONFIG when selecting opencl PACKAGECONFIG but its dependencies are now gone since we're using mesa-tools-native for libclc. Therefore, this also moves the previous dependencies of libclc PACKAGECONFIG to opencl such that we can still build rusticl which still requires all dependencies from previous implementation of libclc (as specified in meson.build[1][2][3][4]). For some reason, libclc PACKAGECONFIG is still required otherwise rusticl fails to build with the following (stripped) message: """ FAILED: [code=101] src/gallium/frontends/rusticl/rusticl_libc_bindings.rs /build/tmp/work/cortexa35-poky-linux/mesa/25.3.3/recipe-sysroot-native/usr/bin/bindgen ../sources/mesa-25.3.3/src/gallium/frontends/rusticl/rusticl_libc_bindings.h --output /build/tmp/work/cortexa35-poky-linux/mesa/25.3.3/build/src/gallium/frontends/rusticl/rusticl_libc_bindings.rs [...] -MD -MQ ../sources/mesa-25.3.3/src/gallium/frontends/rusticl/rusticl_libc_bindings.h -MF src/gallium/frontends/rusticl/rusticl_libc_bindings.h.d thread 'main' (3601157) panicked at bindgen/lib.rs:616:27: Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])" note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace """ libclang.so is available in the sysroot. Exporting LIBCLANG_PATH with "${STAGING_LIB_DIR}" in the recipe doesn't do anything. So for now, we keep telling the user to add libclc PACKAGECONFIG when opencl is selected (and keep it in mesa.bb when DISTRO_FEATURES has opencl) and maybe can figure out why we cannot build rusticl without libclc PACKAGECONFIG later on. I'm also not sure if the Note that does mean that when selecting opencl, mesa will bring the expensive dependencies again, but I'm not sure there's anything we can do about that at the moment. [1] https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-25.3.4/meson.build?ref_type=tags#L838-L839 [2] https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-25.3.4/meson.build?ref_type=tags#L850-L852 [3] https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-25.3.4/meson.build?ref_type=tags#L1849-L1850 [4] https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-25.3.4/meson.build?ref_type=tags#L1855-L1856 Suggested-by: Ross Burton Signed-off-by: Quentin Schulz Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/recipes-graphics/mesa/mesa.inc | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc index 58102dad74..e8dd3ee6ac 100644 --- a/meta/recipes-graphics/mesa/mesa.inc +++ b/meta/recipes-graphics/mesa/mesa.inc @@ -88,9 +88,9 @@ PACKAGECONFIG[glvnd] = "-Dglvnd=enabled, -Dglvnd=disabled, libglvnd" PACKAGECONFIG[opengl] = "-Dopengl=true, -Dopengl=false" -# "opencl" also requires libclc and gallium-llvm to be present in PKGCONFIG! +# "opencl" also requires libclc and gallium-llvm to be present in PACKAGECONFIG! # Be sure to enable them both for the target and for the native build. -PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true -Dmesa-clc-bundle-headers=enabled, -Dgallium-rusticl=false, bindgen-cli-native clang" +PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true -Dmesa-clc-bundle-headers=enabled, -Dgallium-rusticl=false, bindgen-cli-native clang libclc spirv-tools spirv-llvm-translator" X11_DEPS = "xorgproto virtual/libx11 libxext libxxf86vm libxdamage libxfixes xrandr xorgproto libxshmfence" # "x11" requires "opengl" @@ -201,14 +201,7 @@ GALLIUMDRIVERS .= "${@bb.utils.contains('PACKAGECONFIG', 'zink', ',zink', '', d) PACKAGECONFIG[gallium] = "-Dgallium-drivers=${@strip_comma('${GALLIUMDRIVERS}')}, -Dgallium-drivers='', libdrm" PACKAGECONFIG[gallium-llvm] = "-Dllvm=enabled -Dshared-llvm=enabled, -Dllvm=disabled, llvm llvm-native elfutils" -MESA_CLC = "system" -MESA_CLC:class-native = "enabled" -INSTALL_MESA_CLC = "false" -INSTALL_MESA_CLC:class-native = "true" -MESA_NATIVE = "mesa-native" -MESA_NATIVE:class-native = "" - -PACKAGECONFIG[libclc] = "-Dmesa-clc=${MESA_CLC} -Dinstall-mesa-clc=${INSTALL_MESA_CLC} -Dmesa-clc-bundle-headers=enabled,,libclc spirv-tools spirv-llvm-translator ${MESA_NATIVE}" +PACKAGECONFIG[libclc] = "-Dmesa-clc=system -Dprecomp-compiler=system,,mesa-tools-native" PACKAGECONFIG[va] = "-Dgallium-va=enabled,-Dgallium-va=disabled,libva-initial" PACKAGECONFIG[perfetto] = "-Dperfetto=true,-Dperfetto=false,libperfetto" -- 2.47.3