mesa: upgrade to 25.0.2
v2 cover mesa: upgrade to 25.0.2
libclc is required in order to build Intel drivers in Mesa 24.1 and later. Thus OE-Core is currently locked to the 24.0.x branch, which is no longer maintained, having last release in June 2024.
A clean solution is to package Clang, then use it to build libclc and SPIRV-LLVM-Translator (required for Mesa OpenCL support). However creating proper recipes for Clang is a long process (ongoing by Khem Raj).
This patchset attempts to solve the issue in a simpler way: by building libclc and SPIRV-LLVM-Translator together with the LLVM. This way we don't have to create target Clang recipes, there is no extra toolchain to support, etc. Clang binaries are creted as a part of the build process (in order to support building target packages), however it only hits the LLVM sysroot-native and is only used by the LLVM target build.
Future work by Khem (once Clang is properly supported in OE-Core) should allow us to create proper recipes for libclc and spirv-llvm-translator and drop them from the llvm / clang recipe.
I think this approach provides a good balance between OE-Core being stuck with the outdated Mesa release and being able to upgrade it, bringing support for new hardware.
Last two patches of the series bring in RustiCL support, a new OpenCL implementation within Mesa. They are optional for the sake of the upgrade and can be dropped if there is any issue with those. RustiCL support is mostly compile-tested at this point.
Changes since v1:
- Dropped YOCTO_ALTERNATE_LIBDIR patch
- Reworked mesa / LLVM integration to always use get_option('libdir')
- Reenabled AMD Vulkan driver (got disabled because of c&p error)
- Moved mesa-clc options to the libclc PACKAGECONFIG to fix several build errors
Dmitry Baryshkov (6):
llvm: move libLLVM.so.N.M to llvm-libllvm package
llvm: use OECMAKE_SOURCEPATH to specify cmake dir
llvm: support building libclc
llvm: add SPIRV-LLVM-Translator support
mesa: upgrade 24.0.7 -> 25.0.2
bindgen-cli: a tool to generate Rust bindings
Zoltán Böszörményi (1):
mesa: add support for RustiCL under PACKAGECONFIG "opencl"
meta/conf/distro/include/maintainers.inc | 1 + .../bindgen-cli/bindgen-cli-crates.inc | 186 ++++++++++++++++++ .../bindgen-cli/bindgen-cli_0.71.1.bb | 19 ++ ...ossCompile-pass-SPIR-V-headers-path-.patch | 40 ++++ .../llvm/llvm/fix-native-compilation.patch | 67 +++++++ .../llvm/llvm/spirv-internal-build.patch | 27 +++ meta/recipes-devtools/llvm/llvm_20.1.0.bb | 76 ++++++- ...-meson-do-not-pull-in-clc-for-clover.patch | 53 ----- ...lude-missing-llvm-IR-header-Module.h.patch | 41 ---- .../0001-drisw-fix-build-without-dri3.patch | 58 ------ ...on-t-encode-build-path-into-binaries.patch | 46 ++++- ...son-use-target-path-for-Clang-libdir.patch | 57 ++++++ ...cross-compilation-arguments-to-LLVM-.patch | 64 ++++++ ...on-t-try-zink-if-not-enabled-in-mesa.patch | 42 ---- meta/recipes-graphics/mesa/mesa.inc | 102 +++++----- 15 files changed, 625 insertions(+), 254 deletions(-) create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli_0.71.1.bb create mode 100644 meta/recipes-devtools/llvm/llvm/0001-cmake-modules-CrossCompile-pass-SPIR-V-headers-path-.patch create mode 100644 meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch create mode 100644 meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-Revert-meson-do-not-pull-in-clc-for-clover.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-drisw-fix-build-without-dri3.patch create mode 100644 meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch delete mode 100644 meta/recipes-graphics/mesa/files/0002-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch
Signature · 1 line
2.39.5
PATCH v2 1/7 llvm: move libLLVM.so.N.M to llvm-libllvm package
Neither MAJOR_VER nor MINOR_VER are defined, so libLLVM.so.N.M ends up in the main libllvm package rather than the llvm-libllvm package, as expected. Fix this by properly using two-component version.
--- meta/recipes-devtools/llvm/llvm_20.1.0.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2 -1
@@ -19,6 +19,7 @@ VER_SUFFIX = "" PV .= "${VER_SUFFIX}" MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}" +MAJ_MIN_VERSION = "${@oe.utils.trim_version("${PV}", 2)}" LLVM_RELEASE = "${PV}"
@@ -152,7 +153,7 @@ FILES:${PN}-bugpointpasses = "\ FILES:${PN}-libllvm = "\ ${libdir}/libLLVM-${MAJOR_VERSION}.so \ - ${libdir}/libLLVM.so.${MAJOR_VER}.${MINOR_VER} \ + ${libdir}/libLLVM.so.${MAJ_MIN_VERSION} \ " FILES:${PN}-liblto += "\
Signature · 1 line
2.39.5
PATCH v2 2/7 llvm: use OECMAKE_SOURCEPATH to specify cmake dir
In reply to Dmitry BaryshkovInstead of pushing an llvm sourcedir into S, specify it through the OECMAKE_SOURCEPATH so that all the patches are applied to the topdir and debug paths also use top path to map.
--- meta/recipes-devtools/llvm/llvm_20.1.0.bb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
meta/recipes-devtools/llvm/llvm_20.1.0.bb +5 -3
@@ -24,15 +24,17 @@ MAJ_MIN_VERSION = "${@oe.utils.trim_version("${PV}", 2)}" LLVM_RELEASE = "${PV}" SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \ - file://0007-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ - file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ + file://0007-llvm-allow-env-override-of-exe-path.patch \ + file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ file://llvm-config \ " SRC_URI[sha256sum] = "4579051e3c255fb4bb795d54324f5a7f3ef79bd9181e44293d7ee9a7f62aad9a" UPSTREAM_CHECK_URI = "https://github.com/llvm/llvm-project" UPSTREAM_CHECK_REGEX = "llvmorg-(?P<pver>\d+(\.\d+)+)" -S = "${WORKDIR}/llvm-project-${PV}.src/llvm" +S = "${WORKDIR}/llvm-project-${PV}.src" + +OECMAKE_SOURCEPATH = "${S}/llvm" LLVM_INSTALL_DIR = "${WORKDIR}/llvm-install"
Signature · 1 line
2.39.5
PATCH v2 3/7 llvm: support building libclc
In reply to Dmitry BaryshkovCurrent Mesa requires libclc in order to build Intel Gallium (iris) or Vulkan drivers. In order to unblock Mesa updates, build libclc (and clang) as a part of the build process. Don't install clang into the target system, it is only used during the build process. Proper handling of clang as a toolchain is a separate and much more complicated topic.
--- .../llvm/llvm/fix-native-compilation.patch | 67 +++++++++++++++++++ meta/recipes-devtools/llvm/llvm_20.1.0.bb | 43 ++++++++++-- 2 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch
meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch new file +67 -0
@@ -0,0 +1,67 @@ +From e94e529aefb28b65165e978daa2bfd89867ee8d0 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <[email protected]> +Date: Fri, 21 Mar 2025 17:17:52 +0200 +Subject: [PATCH] cmake/modules/CrossCompile: fix NATIVE build setup + +Fix variables being passed to cmake when generating NATIVE build dir. + +Upstream-Status: Inappropriate [OE-Specific build-system fix] +Signed-off-by: Dmitry Baryshkov <[email protected]> + +Index: llvm-project-20.1.0.src/llvm/cmake/modules/CrossCompile.cmake +=================================================================== +--- llvm-project-20.1.0.src.orig/llvm/cmake/modules/CrossCompile.cmake ++++ llvm-project-20.1.0.src/llvm/cmake/modules/CrossCompile.cmake +@@ -23,19 +23,37 @@ function(llvm_create_cross_target projec + if (EXISTS ${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake) + set(CROSS_TOOLCHAIN_FLAGS_INIT + -DCMAKE_TOOLCHAIN_FILE=\"${LLVM_MAIN_SRC_DIR}/cmake/platforms/${toolchain}.cmake\") ++ elseif (${target_name} STREQUAL NATIVE) ++ set(CROSS_TOOLCHAIN_FLAGS_INIT ++ -DCMAKE_C_COMPILER=\"${LLVM_NATIVE_C_COMPILER}\" ++ -DCMAKE_CXX_COMPILER=\"${LLVM_NATIVE_CXX_COMPILER}\" ++ -DCMAKE_C_FLAGS=\"${LLVM_NATIVE_C_FLAGS}\" ++ -DCMAKE_CXX_FLAGS=\"${LLVM_NATIVE_CXX_FLAGS}\" ++ -DCMAKE_EXE_LINKER_FLAGS=\"${LLVM_NATIVE_LD_FLAGS}\" ++ ) + elseif (NOT CMAKE_CROSSCOMPILING) + set(CROSS_TOOLCHAIN_FLAGS_INIT + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + ) + endif() + set(CROSS_TOOLCHAIN_FLAGS_${target_name} ${CROSS_TOOLCHAIN_FLAGS_INIT} + CACHE STRING "Toolchain configuration for ${target_name}") + + # project specific version of the flags up above + set(CROSS_TOOLCHAIN_FLAGS_${project_name}_${target_name} "" + CACHE STRING "Toolchain configuration for ${project_name}_${target_name}") + ++ if (${target_name} STREQUAL NATIVE) ++ set(cross_flags ++ "-DLLVM_DEFAULT_TARGET_TRIPLE='${LLVM_NATIVE_TRIPLE}'") ++ else() ++ set(cross_flags ++ "-DLLVM_DEFAULT_TARGET_TRIPLE='${LLVM_TARGET_TRIPLE}'" ++ "-DLLVM_TARGET_ARCH='${LLVM_TARGET_ARCH}'" ++ "-DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE") ++ endif() ++ + if (buildtype) + set(build_type_flags "-DCMAKE_BUILD_TYPE=${buildtype}") + endif() +@@ -91,12 +111,11 @@ function(llvm_create_cross_target projec + -DCMAKE_C_COMPILER_LAUNCHER="${CMAKE_C_COMPILER_LAUNCHER}" + -DCMAKE_CXX_COMPILER_LAUNCHER="${CMAKE_CXX_COMPILER_LAUNCHER}" + ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_CURRENT_SOURCE_DIR} ++ #${CROSS_TOOLCHAIN_FLAGS_INIT} ${CMAKE_CURRENT_SOURCE_DIR} + ${CROSS_TOOLCHAIN_FLAGS_${project_name}_${target_name}} +- -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE ++ ${cross_flags} + -DLLVM_TARGETS_TO_BUILD="${targets_to_build_arg}" + -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="${experimental_targets_to_build_arg}" +- -DLLVM_DEFAULT_TARGET_TRIPLE="${LLVM_TARGET_TRIPLE}" +- -DLLVM_TARGET_ARCH="${LLVM_TARGET_ARCH}" + -DLLVM_ENABLE_PROJECTS="${llvm_enable_projects_arg}" + -DLLVM_EXTERNAL_PROJECTS="${llvm_external_projects_arg}" + -DLLVM_ENABLE_RUNTIMES="${llvm_enable_runtimes_arg}"
meta/recipes-devtools/llvm/llvm_20.1.0.bb +39 -4
110 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [OE-core] [PATCH v2 3/7] llvm: support building libclc
meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch line 8
Quoted 3 lines · Dmitry Baryshkov via lists.openembedded.org
meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch new file +3
-0+Fix variables being passed to cmake when generating NATIVE build dir. + +Upstream-Status: Inappropriate [OE-Specific build-system fix]
Please write a better, detailed explanation of what the patch does. Why do we need it in the first place?
meta/recipes-devtools/llvm/llvm_20.1.0.bb def get_llvm_arch(bb, d, arch_var): · line 70
Quoted 2 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +1
-1-LLVM_TARGETS ?= "AMDGPU;${@get_llvm_host_arch(bb, d)}" +LLVM_TARGETS ?= "AMDGPU;NVPTX;SPIRV;${@get_llvm_host_arch(bb, d)}"
Why this addition? Needs to be explained in commit message.
meta/recipes-devtools/llvm/llvm_20.1.0.bb def get_llvm_arch(bb, d, arch_var): · line 76
Quoted 2 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2
-0+LLVM_PROJECTS = "${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'clang;libclc', '', d)}" +
Same.
meta/recipes-devtools/llvm/llvm_20.1.0.bb EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ · line 96
Quoted 7 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +7
-0+ -DLLVM_ENABLE_PROJECTS='${LLVM_PROJECTS}' \ + -DLLVM_NATIVE_TRIPLE='${BUILD_SYS}' \ + -DLLVM_NATIVE_C_COMPILER=\'${@ d.getVar('BUILD_CC').replace('ccache', '').strip()}\' \ + -DLLVM_NATIVE_CXX_COMPILER=\'${@ d.getVar('BUILD_CXX').replace('ccache', '').strip()}\' \ + -DLLVM_NATIVE_C_FLAGS='${BUILD_CFLAGS}' \ + -DLLVM_NATIVE_CXX_FLAGS='${BUILD_CXXFLAGS}' \ + -DLLVM_NATIVE_LD_FLAGS='${BUILD_LDFLAGS}' \
Same.
meta/recipes-devtools/llvm/llvm_20.1.0.bb EXTRA_OECMAKE:append:class-target = "\ · line 105
Quoted 7 lines
EXTRA_OECMAKE:append:class-target = "\
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2
-0@@ -89,6 +101,8 @@ EXTRA_OECMAKE:append:class-target = "\ -DLLVM_HOST_TRIPLE=${TARGET_SYS} \ -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \ -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ + -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \ + -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
Same.
meta/recipes-devtools/llvm/llvm_20.1.0.bb EXTRA_OECMAKE:append:class-nativesdk = "\ · line 114
Quoted 7 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2
-0EXTRA_OECMAKE:append:class-nativesdk = "\@@ -96,6 +110,8 @@ EXTRA_OECMAKE:append:class-nativesdk = "\ -DLLVM_HOST_TRIPLE=${SDK_SYS} \ -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \ -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ + -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \ + -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \
Same.
meta/recipes-devtools/llvm/llvm_20.1.0.bb do_install() { · line 143
Quoted 7 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +1
-1# patch out build host paths for reproducibility@@ -124,11 +140,26 @@ do_install() { # Remove opt-viewer: https://llvm.org/docs/Remarks.html rm -rf ${D}${datadir}/opt-viewer - rmdir ${D}${datadir} + rmdir ${D}${datadir} || true
Same.
Quoted 4 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +4
-0+ # Remove clang bits from target packages, we are not providing it for the system + if ${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'true', 'false', d)} && + [ "${CLASSOVERRIDE}" != "class-native" ] ; then + rm -f ${D}${bindir}/clang*
meta/recipes-devtools/llvm/llvm_20.1.0.bb do_install() { · line 162
Quoted 10 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +10
-0+ rm -fr ${D}${libdir}/clang + rm -fr ${D}${datadir}/clang + + rm -f ${D}${bindir}/scan* + rm -fr ${D}${libdir}/libscanbuild + rm -fr ${D}${datadir}/scan-build + rm -fr ${D}${datadir}/scan-view + + rm -fr ${D}${libdir}/libear + fi
Why does this need to be done, if we're only adding libclc? Is it dependent on those bits being built?
meta/recipes-devtools/llvm/llvm_20.1.0.bb llvm_sysroot_preprocess() { · line 183
Quoted 2 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2
-0+PROVIDES = "libclc" +RPROVIDES:${PN}-clc += "libclc"
Why these additions?
Alex
Re: [OE-core] [PATCH v2 3/7] llvm: support building libclc
Quoted 9 lines · Alexander Kanavin
meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch line 8
Quoted 3 lines · Dmitry Baryshkov via lists.openembedded.org
meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch new file +3
-0+Fix variables being passed to cmake when generating NATIVE build dir. + +Upstream-Status: Inappropriate [OE-Specific build-system fix]Please write a better, detailed explanation of what the patch does. Why do we need it in the first place?
ack
Quoted 5 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb def get_llvm_arch(bb, d, arch_var): · line 70
Quoted 3 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +1
-1-LLVM_TARGETS ?= "AMDGPU;${@get_llvm_host_arch(bb, d)}" +LLVM_TARGETS ?= "AMDGPU;NVPTX;SPIRV;${@get_llvm_host_arch(bb, d)}"Why this addition? Needs to be explained in commit message.
ack, I'll split it to a separate patch
Quoted 5 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb def get_llvm_arch(bb, d, arch_var): · line 76
Quoted 3 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2
-0+LLVM_PROJECTS = "${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'clang;libclc', '', d)}" +Same.
Well... This is kind of described in the commit message, but I will expand the clang part.
Quoted 34 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ · line 96
Quoted 8 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +7
-0+ -DLLVM_ENABLE_PROJECTS='${LLVM_PROJECTS}' \ + -DLLVM_NATIVE_TRIPLE='${BUILD_SYS}' \ + -DLLVM_NATIVE_C_COMPILER=\'${@ d.getVar('BUILD_CC').replace('ccache', '').strip()}\' \ + -DLLVM_NATIVE_CXX_COMPILER=\'${@ d.getVar('BUILD_CXX').replace('ccache', '').strip()}\' \ + -DLLVM_NATIVE_C_FLAGS='${BUILD_CFLAGS}' \ + -DLLVM_NATIVE_CXX_FLAGS='${BUILD_CXXFLAGS}' \ + -DLLVM_NATIVE_LD_FLAGS='${BUILD_LDFLAGS}' \Same.
meta/recipes-devtools/llvm/llvm_20.1.0.bb EXTRA_OECMAKE:append:class-target = "\ · line 105
Quoted 7 lines
EXTRA_OECMAKE:append:class-target = "\
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2
-0@@ -89,6 +101,8 @@ EXTRA_OECMAKE:append:class-target = "\ -DLLVM_HOST_TRIPLE=${TARGET_SYS} \ -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \ -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ + -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \ + -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \Same.
meta/recipes-devtools/llvm/llvm_20.1.0.bb EXTRA_OECMAKE:append:class-nativesdk = "\ · line 114
Quoted 7 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2
-0EXTRA_OECMAKE:append:class-nativesdk = "\@@ -96,6 +110,8 @@ EXTRA_OECMAKE:append:class-nativesdk = "\ -DLLVM_HOST_TRIPLE=${SDK_SYS} \ -DLLVM_TABLEGEN=${STAGING_BINDIR_NATIVE}/llvm-tblgen${PV} \ -DLLVM_CONFIG_PATH=${STAGING_BINDIR_NATIVE}/llvm-config${PV} \ + -DLLVM_NATIVE_TOOL_DIR=${STAGING_BINDIR_NATIVE} \ + -DCLANG_TABLEGEN=${STAGING_BINDIR_NATIVE}/clang-tblgen \Same.
Quoted 3 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +0
-0# patch out build host paths for reproducibility@@ -124,11 +140,26 @@ do_install() {
Quoted 6 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb do_install() { · line 143
Quoted 4 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +1
-1# Remove opt-viewer: https://llvm.org/docs/Remarks.html rm -rf ${D}${datadir}/opt-viewer - rmdir ${D}${datadir} + rmdir ${D}${datadir} || trueSame.
Ack
Quoted 10 lines
Quoted 10 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +9
-0+ # Remove clang bits from target packages, we are not providing it for the system + if ${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'true', 'false', d)} && + [ "${CLASSOVERRIDE}" != "class-native" ] ; then + rm -f ${D}${bindir}/clang* + rm -fr ${D}${libdir}/clang + rm -fr ${D}${datadir}/clang + + rm -f ${D}${bindir}/scan* + rm -fr ${D}${libdir}/libscanbuild
Quoted 8 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb do_install() { · line 162
Quoted 5 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +5
-0+ rm -fr ${D}${datadir}/scan-build + rm -fr ${D}${datadir}/scan-view + + rm -fr ${D}${libdir}/libear + fiWhy does this need to be done, if we're only adding libclc? Is it dependent on those bits being built?
This definitely is described in the commit message: 'Don't install clang into the target system, it is only used during the build process.'
Quoted 8 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb llvm_sysroot_preprocess() { · line 183
Quoted 3 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +2
-0+PROVIDES = "libclc" +RPROVIDES:${PN}-clc += "libclc"Why these additions?
Alex
Signature · 2 lines
With best wishes Dmitry
Re: [OE-core] [PATCH v2 3/7] llvm: support building libclc
Quoted 18 lines · Dmitry Baryshkov
Quoted 9 lines
Quoted 9 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +9
-0+ # Remove clang bits from target packages, we are not providing it for the system + if ${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'true', 'false', d)} && + [ "${CLASSOVERRIDE}" != "class-native" ] ; then + rm -f ${D}${bindir}/clang* + rm -fr ${D}${libdir}/clang + rm -fr ${D}${datadir}/clang + + rm -f ${D}${bindir}/scan* + rm -fr ${D}${libdir}/libscanbuildQuoted 8 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb do_install() { · line 162
Quoted 5 lines
meta/recipes-devtools/llvm/llvm_20.1.0.bb +5
-0+ rm -fr ${D}${datadir}/scan-build + rm -fr ${D}${datadir}/scan-view + + rm -fr ${D}${libdir}/libear + fiWhy does this need to be done, if we're only adding libclc? Is it dependent on those bits being built?
Quoted 2 lines
This definitely is described in the commit message: 'Don't install clang into the target system, it is only used during the build process.'
What I don't understand is why target executables are being built, if we only need to build a target library. If they can't be run directly, how are they used during the build process?
Alex
PATCH v2 4/7 llvm: add SPIRV-LLVM-Translator support
In reply to Dmitry BaryshkovMesa builds require SPIRV-LLVM-Translator in order to build CLC support. While it is possible to build it separately (like meta-clang does), it also requires a separate clang compiler (which OE-Core doesn't provide).
Use an alternative path and build SPIRV-LLVM-Translator as a part of the LLVM build process, lifting the requirement for the separate clang. Once clang is properly integrated into the OE-Core layer, this can be split to a separate package and dropped.
--- ...ossCompile-pass-SPIR-V-headers-path-.patch | 40 +++++++++++++++++++ .../llvm/llvm/spirv-internal-build.patch | 27 +++++++++++++ meta/recipes-devtools/llvm/llvm_20.1.0.bb | 32 ++++++++++++--- 3 files changed, 94 insertions(+), 5 deletions(-) create mode 100644 meta/recipes-devtools/llvm/llvm/0001-cmake-modules-CrossCompile-pass-SPIR-V-headers-path-.patch create mode 100644 meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch
meta/recipes-devtools/llvm/llvm/0001-cmake-modules-CrossCompile-pass-SPIR-V-headers-path-.patch new file +40 -0
@@ -0,0 +1,40 @@ +From e94e529aefb28b65165e978daa2bfd89867ee8d0 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <[email protected]> +Date: Fri, 21 Mar 2025 17:17:52 +0200 +Subject: [PATCH] cmake/modules/CrossCompile: pass SPIR-V headers path to + native build + +In case LLVM is being built together with SPIRV-LLVM-Translator, it +might be required to pass LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR define +to the native build too. Extend native build setup to pass that variable +to the called cmake too. + +Upstream-Status: Inappropriate [OE-Specific build-system fix] +Signed-off-by: Dmitry Baryshkov <[email protected]> +--- + llvm/cmake/modules/CrossCompile.cmake | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake +index 3b31d3e218a3..24b62f4ff8af 100644 +--- a/llvm/cmake/modules/CrossCompile.cmake ++++ b/llvm/cmake/modules/CrossCompile.cmake +@@ -81,6 +81,10 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) + set(libc_flags -DLLVM_LIBC_GPU_BUILD=ON) + endif() + ++ if (LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR) ++ set(spirv_headers "-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR}") ++ endif() ++ + add_custom_command(OUTPUT ${${project_name}_${target_name}_BUILD}/CMakeCache.txt + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" + -DCMAKE_MAKE_PROGRAM="${CMAKE_MAKE_PROGRAM}" +@@ -101,6 +105,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype) + -DLLVM_INCLUDE_BENCHMARKS=OFF + -DLLVM_INCLUDE_TESTS=OFF + ${build_type_flags} ${linker_flag} ${external_clang_dir} ${libc_flags} ++ ${spirv_headers} + ${ARGN} + WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD} + DEPENDS CREATE_${project_name}_${target_name}
meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch new file +27 -0
@@ -0,0 +1,27 @@ +From e94e529aefb28b65165e978daa2bfd89867ee8d0 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <[email protected]> +Date: Fri, 21 Mar 2025 17:17:52 +0200 +Subject: [PATCH] SPIRV-LLVM-Translator: fix handling of built-in SPIRV targer + +Upstream-Status: Pending +Signed-off-by: Dmitry Baryshkov <[email protected]> + +Index: llvm-project-20.1.0.src/llvm/projects/SPIRV-LLVM-Translator/CMakeLists.txt +=================================================================== +--- llvm-project-20.1.0.src.orig/llvm/projects/SPIRV-LLVM-Translator/CMakeLists.txt ++++ llvm-project-20.1.0.src/llvm/projects/SPIRV-LLVM-Translator/CMakeLists.txt +@@ -116,6 +116,14 @@ if(LLVM_SPIRV_BUILD_EXTERNAL) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif() ++else() ++ message(STATUS "Internal LLVM library") ++ is_llvm_target_library("SPIRV" spirv_present_result INCLUDED_TARGETS) ++ if(spirv_present_result) ++ message(STATUS "Found SPIR-V Backend") ++ set(SPIRV_BACKEND_FOUND TRUE) ++ add_compile_definitions(LLVM_SPIRV_BACKEND_TARGET_PRESENT) ++ endif() + endif() + + set(LLVM_SPIRV_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
meta/recipes-devtools/llvm/llvm_20.1.0.bb +27 -5
@@ -23,10 +23,20 @@ MAJ_MIN_VERSION = "${@oe.utils.trim_version("${PV}", 2)}" LLVM_RELEASE = "${PV}" +SRCREV_spirv = "68edc9d3d10ff6ec6353803a1bc60a5c25e7b715" +SPIRV_BRANCH = "llvm_release_200" + +SRC_URI_SPIRV = " \ + git://github.com/KhronosGroup/SPIRV-LLVM-Translator;protocol=https;name=spirv;branch=${SPIRV_BRANCH};destsuffix=llvm-project-${PV}.src/llvm/projects/SPIRV-LLVM-Translator \ + file://0001-cmake-modules-CrossCompile-pass-SPIR-V-headers-path-.patch \ + file://spirv-internal-build.patch \ +" + SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/llvm-project-${PV}.src.tar.xz \ file://0007-llvm-allow-env-override-of-exe-path.patch \ file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \ file://fix-native-compilation.patch \ + ${@bb.utils.contains('PACKAGECONFIG', 'spirv', '${SRC_URI_SPIRV}', '', d)} \ file://llvm-config \ "
@@ -58,11 +68,12 @@ def get_llvm_arch(bb, d, arch_var): def get_llvm_host_arch(bb, d): return get_llvm_arch(bb, d, 'HOST_ARCH') -PACKAGECONFIG ??= "libllvm libclc" +PACKAGECONFIG ??= "libllvm libclc spirv" # if optviewer OFF, force the modules to be not found or the ones on the host would be found PACKAGECONFIG[optviewer] = ",-DPY_PYGMENTS_FOUND=OFF -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF -DPY_YAML_FOUND=OFF,python3-pygments python3-pyyaml,python3-pygments python3-pyyaml" PACKAGECONFIG[libllvm] = "" PACKAGECONFIG[libclc] = "" +PACKAGECONFIG[spirv] = "-DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=${STAGING_INCDIR}/.. ,,spirv-tools-native spirv-headers" # # Default to build all OE-Core supported target arches (user overridable).
@@ -72,7 +83,9 @@ LLVM_TARGETS ?= "AMDGPU;NVPTX;SPIRV;${@get_llvm_host_arch(bb, d)}" ARM_INSTRUCTION_SET:armv5 = "arm" ARM_INSTRUCTION_SET:armv4t = "arm" -LLVM_PROJECTS = "${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'clang;libclc', '', d)}" +LLVM_PROJECTS_CLANG = "${@bb.utils.contains_any('PACKAGECONFIG', 'libclc spirv', 'clang', '', d)}" +LLVM_PROJECTS_CLC = "${@bb.utils.contains('PACKAGECONFIG', 'libclc', ';libclc', '', d)}" +LLVM_PROJECTS = "${LLVM_PROJECTS_CLANG}${LLVM_PROJECTS_CLC}" EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \ -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
@@ -147,7 +160,7 @@ do_install() { fi # Remove clang bits from target packages, we are not providing it for the system - if ${@bb.utils.contains('PACKAGECONFIG', 'libclc', 'true', 'false', d)} && + if ${@bb.utils.contains_any('PACKAGECONFIG', 'libclc spirv', 'true', 'false', d)} && [ "${CLASSOVERRIDE}" != "class-native" ] ; then rm -f ${D}${bindir}/clang* rm -fr ${D}${libdir}/clang
@@ -176,11 +189,12 @@ llvm_sysroot_preprocess() { ln -sf llvm-config ${SYSROOT_DESTDIR}${bindir_crossscripts}/llvm-config${PV} } -PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptremarks ${PN}-liblto ${PN}-clc" -PROVIDES = "libclc" +PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-libllvm ${PN}-liboptremarks ${PN}-liblto ${PN}-clc ${PN}-spirv" +PROVIDES = "libclc spirv-llvm-translator" RRECOMMENDS:${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liboptremarks" RPROVIDES:${PN}-clc += "libclc" +RPROVIDES:${PN}-spirv += "spirv-llvm-translator" FILES:${PN}-bugpointpasses = "\ ${libdir}/BugpointPasses.so \
@@ -215,6 +229,14 @@ FILES:${PN}-staticdev += "\ FILES:${PN}-clc += "${datadir}/clc" +FILES:${PN}-spirv = " \ + ${bindir}/llvm-spirv \ + ${includedir}/LLVMSPIRVLib \ + ${libdir}/pkgconfig/LLVMSPIRVLib.pc \ + ${libdir}/libLLVMSPIRV* \ +" + INSANE_SKIP:${PN}-libllvm += "dev-so" +INSANE_SKIP:${PN}-spirv += "staticdev" BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.39.5
Re: [OE-core] [PATCH v2 4/7] llvm: add SPIRV-LLVM-Translator support
Quoted 1 line · Dmitry Baryshkov via lists.openembedded.org
+Upstream-Status: Inappropriate [OE-Specific build-system fix]
What makes it inappropriate? I know people commonly use 'oe-core specific' as a shortcut, but there really should be a proper explanation.
meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch line 6
Quoted 3 lines
meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch new file +3
-0+Subject: [PATCH] SPIRV-LLVM-Translator: fix handling of built-in SPIRV targer + +Upstream-Status: Pending
Fix handling how? Pending why?
Quoted 1 line
+INSANE_SKIP:${PN}-spirv += "staticdev"
Why this tweak?
I understand you want to get to a working patchset as quickly as possible, but please do not take shortcuts with explaining what you did and why. We need to make sure someone else can understand what is going on.
Alex
PATCH v2 5/7 mesa: upgrade 24.0.7 -> 25.0.2
In reply to Dmitry BaryshkovUpgrade the Mesa package, dropping applied and refreshing outstanding patches. The dri3 config option is now gone, dependencies are merged into X11 deps. The swrast gallium driver has been split into softpipe and llvmpipe drivers. Reworked OpenCL support to use mesa_clc compiler.
Changelog:
https://docs.mesa3d.org/relnotes/25.0.2.html
License-Update: license text cleared and clarified.
--- ...-meson-do-not-pull-in-clc-for-clover.patch | 53 ------------ ...lude-missing-llvm-IR-header-Module.h.patch | 41 --------- .../0001-drisw-fix-build-without-dri3.patch | 58 ------------- ...on-t-encode-build-path-into-binaries.patch | 46 ++++++++-- ...son-use-target-path-for-Clang-libdir.patch | 57 +++++++++++++ ...on-t-try-zink-if-not-enabled-in-mesa.patch | 42 ---------- meta/recipes-graphics/mesa/mesa.inc | 84 ++++++++++--------- 7 files changed, 139 insertions(+), 242 deletions(-) delete mode 100644 meta/recipes-graphics/mesa/files/0001-Revert-meson-do-not-pull-in-clc-for-clover.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-drisw-fix-build-without-dri3.patch create mode 100644 meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch delete mode 100644 meta/recipes-graphics/mesa/files/0002-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch
meta/recipes-graphics/mesa/files/0001-Revert-meson-do-not-pull-in-clc-for-clover.patch deleted +0 -53
@@ -1,53 +0,0 @@ -From 051f41beda540f0ae77b341db01a6de83c9e938a Mon Sep 17 00:00:00 2001 -From: Markus Volk <[email protected]> -Date: Fri, 8 Mar 2024 15:53:11 +0100 -Subject: [PATCH] Revert "meson: do not pull in clc for clover" - -This reverts commit 815a6647eb1383e9dc704ffcc266d85f3b13338a. -Upstream-Status: Inappropriate [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27783/diffs?commit_id=a976f2c9f0c07f9e06cc9affd9124b45bc60c2bd] - -Once the merge request above was added, it will only be possible to provide opencl spir-v with gallium-rusticl=true. This is not yet supported in the mesa recipe. -For now reverting this commit allows to still use clover with opencl-spirv, which would otherwise be broken starting from mesa 24.0.2. - -After it was merged, this patch needs to be removed and rusticl support will be required - -Signed-off-by: Markus Volk <[email protected]> ---- - meson.build | 3 ++- - src/compiler/meson.build | 2 +- - 2 files changed, 3 insertions(+), 2 deletions(-) - -diff --git a/meson.build b/meson.build -index 2db6185..741b5d1 100644 ---- a/meson.build -+++ b/meson.build -@@ -813,6 +813,7 @@ if _opencl != 'disabled' - error('The Clover OpenCL state tracker requires rtti') - endif - -+ with_clc = true - with_gallium_opencl = true - with_opencl_icd = _opencl == 'icd' - else -@@ -837,7 +838,7 @@ if with_gallium_rusticl - endif - - dep_clc = null_dep --if with_gallium_opencl or with_clc -+if with_clc - dep_clc = dependency('libclc') - endif - -diff --git a/src/compiler/meson.build b/src/compiler/meson.build -index 8d73544..1dae56d 100644 ---- a/src/compiler/meson.build -+++ b/src/compiler/meson.build -@@ -79,7 +79,7 @@ subdir('nir') - - subdir('spirv') - --if with_clc -+if with_opencl_spirv - subdir('clc') - endif - if with_gallium
meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch deleted +0 -41
41 lines not on this page · raw message
meta/recipes-graphics/mesa/files/0001-drisw-fix-build-without-dri3.patch deleted +0 -58
58 lines not on this page · raw message
meta/recipes-graphics/mesa/files/0001-freedreno-don-t-encode-build-path-into-binaries.patch +39 -7
65 lines not on this page · raw message
meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch new file +57 -0
57 lines not on this page · raw message
meta/recipes-graphics/mesa/files/0002-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch deleted +0 -42
42 lines not on this page · raw message
meta/recipes-graphics/mesa/mesa.inc +43 -41
193 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [OE-core] [PATCH v2 5/7] mesa: upgrade 24.0.7 -> 25.0.2
meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch line 8
Quoted 5 lines · Dmitry Baryshkov via lists.openembedded.org
meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch new file +5
-0+Subject: [PATCH] meson: use target path for Clang libdir + +Instead of trying to detect the target libdir through llvm-config tool +(and ending up with the sysroot path), get libdir from the build +options. Clang is known to use the same libdir in OE build environment.
llvm-config should probably be tweaked to return the correct value instead? Then this patch is unnecessary. Alternatively, we can perhaps offer the patch upstream, explaining why dep_llvm.get_variable(cmake :
'LLVM_LIBRARY_DIR', configtool: 'libdir') won't work in cross-builds?
meta/recipes-graphics/mesa/mesa.inc PACKAGECONFIG[freedreno-fdperf] = ",,libconfig" · line 135
Quoted 2 lines
meta/recipes-graphics/mesa/mesa.inc +1
-1-PACKAGECONFIG[glvnd] = "-Dglvnd=true, -Dglvnd=false, libglvnd" +PACKAGECONFIG[glvnd] = "-Dglvnd=true, -Dglvnd=disabled, libglvnd"
This change is somewhat puzzling - true and false match, but true and disabled do not.
Alex
PATCH v2 6/7 bindgen-cli: a tool to generate Rust bindings
In reply to Dmitry BaryshkovImport bindgen-cli from the meta-clang layer, as it is required to generate bindings for Mesa / RustiCL. Specify Khem as maintainer as he is maintaining the meta-clang layer, which included this recipe too.
--- meta/conf/distro/include/maintainers.inc | 1 + .../bindgen-cli/bindgen-cli-crates.inc | 186 ++++++++++++++++++ .../bindgen-cli/bindgen-cli_0.71.1.bb | 19 ++ 3 files changed, 206 insertions(+) create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli_0.71.1.bb
meta/conf/distro/include/maintainers.inc +1 -0
@@ -64,6 +64,7 @@ RECIPE_MAINTAINER:pn-bash = "Hongxu Jia <[email protected]>" RECIPE_MAINTAINER:pn-bash-completion = "Unassigned <[email protected]>" RECIPE_MAINTAINER:pn-bc = "Anuj Mittal <[email protected]>" RECIPE_MAINTAINER:pn-bind = "Unassigned <[email protected]>" +RECIPE_MAINTAINER:pn-bindgen-cli = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-binutils = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-binutils-cross-${TARGET_ARCH} = "Khem Raj <[email protected]>" RECIPE_MAINTAINER:pn-binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Khem Raj <[email protected]>"
meta/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc new file +186 -0
187 lines not on this page · raw message
meta/recipes-devtools/bindgen-cli/bindgen-cli_0.71.1.bb new file +19 -0
@@ -0,0 +1,19 @@ +SUMMARY = "Automatically generates Rust FFI bindings to C and C++ libraries." +HOMEPAGE = "https://rust-lang.github.io/rust-bindgen/" +LICENSE = "BSD-3-Clause" + +LIC_FILES_CHKSUM = "file://LICENSE;md5=0b9a98cb3dcdefcceb145324693fda9b" + +inherit rust cargo cargo-update-recipe-crates + +SRC_URI += "git://github.com/rust-lang/rust-bindgen.git;protocol=https;branch=main" +SRCREV = "af7fd38d5e80514406fb6a8bba2d407d252c30b9" +S = "${WORKDIR}/git" + +require ${BPN}-crates.inc + +do_install:append:class-native() { + create_wrapper ${D}/${bindir}/bindgen LIBCLANG_PATH="${STAGING_LIBDIR_NATIVE}" +} + +BBCLASSEXTEND = "native"
Signature · 1 line
2.39.5
PATCH v2 7/7 mesa: add support for RustiCL under PACKAGECONFIG "opencl"
In reply to Dmitry BaryshkovFrom: Zoltán Böszörményi <[email protected]>
Mesa now has two OpenCL implementations: Clover (older one) and RustiCL (newer one). Extend the "opencl" package config to include both implementations into the libopencl-mesa (-dev) packages. As the Clover implementation is in maintenance mode and is expected to be removed at Mesa 25.2, it doesn't make sense to split the packages or to provide two config options.
--- ...cross-compilation-arguments-to-LLVM-.patch | 64 +++++++++++++++++++ meta/recipes-graphics/mesa/mesa.inc | 20 ++++-- 2 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch
meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch new file +64 -0
@@ -0,0 +1,64 @@ +From b9cf34f39ca7e7546508ce2ab1f053edef5fc201 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov <[email protected]> +Date: Wed, 26 Mar 2025 17:47:09 +0200 +Subject: [PATCH] rusticl: provide cross-compilation arguments to LLVM bindgen + invocation + +Correctly generating LLVM bindings requires several croos-compilation +arguments. Provide them to rust.bindgen(). + +Upstream-Status: Inappropriate [OE-Specific] +Signed-off-by: Dmitry Baryshkov <[email protected]> +--- + meson_options.txt | 14 ++++++++++++++ + src/gallium/frontends/rusticl/meson.build | 8 ++++++++ + 2 files changed, 22 insertions(+) + +diff --git a/meson_options.txt b/meson_options.txt +index 0147cafcb146..f73e83fded18 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -796,3 +796,17 @@ option( + value : false, + description : 'Install the drivers internal shader compilers (if needed for cross builds).' + ) ++ ++option( ++ 'bindgen-includedir', ++ type : 'string', ++ value : '', ++ description : 'system-wide include directory for cross-generating LLVM bindings' ++ ) ++ ++option( ++ 'bindgen-target', ++ type : 'string', ++ value : '', ++ description : 'Clang target for cross-generating LLVM bindings' ++ ) +diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build +index a5d1dcf3abb9..480c220b7f5f 100644 +--- a/src/gallium/frontends/rusticl/meson.build ++++ b/src/gallium/frontends/rusticl/meson.build +@@ -180,13 +180,21 @@ rusticl_opencl_gen = static_library( + ], + ) + ++bindgen_c_args = [] ++bindgen_target = get_option('bindgen-target') ++if bindgen_target != '' ++ bindgen_c_args += [ '-target', bindgen_target ] ++endif ++ + rusticl_llvm_bindings_rs = rust.bindgen( + input : 'rusticl_llvm_bindings.hpp', + output : 'rusticl_llvm_bindings.rs', + c_args : [ + rusticl_bindgen_c_args, + pre_args, ++ bindgen_c_args, + ], ++ include_directories : get_option('bindgen-includedir'), + dependencies : [ + dep_clang, + dep_llvm,
meta/recipes-graphics/mesa/mesa.inc +15 -5
@@ -18,6 +18,7 @@ SRC_URI = "https://archive.mesa3d.org/mesa-${PV}.tar.xz \ file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ file://0001-freedreno-don-t-encode-build-path-into-binaries.patch\ file://0001-meson-use-target-path-for-Clang-libdir.patch \ + file://0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch \ " SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97"
@@ -46,7 +47,7 @@ PROVIDES = " \ virtual/mesa \ " -inherit meson pkgconfig python3native gettext features_check +inherit meson pkgconfig python3native gettext features_check rust BBCLASSEXTEND = "native nativesdk"
@@ -85,6 +86,9 @@ PACKAGECONFIG = " \ ${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'zink', '', d)} \ " +# skip all Rust dependencies if we are not building OpenCL" +INHIBIT_DEFAULT_RUST_DEPS = "${@bb.utils.contains('PACKAGECONFIG', 'opencl', '', '1', d)}" + PACKAGECONFIG:append:x86 = " libclc gallium-llvm" PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm" PACKAGECONFIG:append:class-native = " libclc gallium-llvm r600"
@@ -140,9 +144,15 @@ PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2 # "egl" requires "opengl" PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled" +BINDGEN_TARGET = "${TARGET_ARCH}-${TARGET_OS}${LIBCEXTENSION}${@['-gnu', ''][d.getVar('LIBCEXTENSION') != '']}" + # "opencl" also requires libclc and gallium-llvm to be present in PKGCONFIG! # Be sure to enable them both for the target and for the native build. -PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd,-Dgallium-opencl=disabled," +PACKAGECONFIG[opencl] = " \ + -Dgallium-opencl=icd -Dgallium-rusticl=true -Dbindgen-includedir=${STAGING_INCDIR} -Dbindgen-target=${BINDGEN_TARGET},\ + -Dgallium-opencl=disabled -Dgallium-rusticl=false, \ + bindgen-cli-native \ +" PACKAGECONFIG[broadcom] = "" PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native"
@@ -242,7 +252,7 @@ RDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev" RDEPENDS:libgles2-mesa += "libgles3-mesa" ALLOW_EMPTY:libgles3-mesa = "1" -RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools', '', d)}" +RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools spirv-llvm-translator', '', d)}" PACKAGES =+ "libegl-mesa libegl-mesa-dev \ libosmesa libosmesa-dev \
@@ -348,7 +358,7 @@ 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}/lib*OpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/*.icd" FILES:libglapi = "${libdir}/libglapi.so.*" FILES:libosmesa = "${libdir}/libOSMesa.so.*" FILES:libxatracker = "${libdir}/libxatracker.so.*"
@@ -362,7 +372,7 @@ FILES:libglapi-dev = "${libdir}/libglapi.*" FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" FILES:libgles3-mesa-dev = "${includedir}/GLES3" -FILES:libopencl-mesa-dev = "${libdir}/libMesaOpenCL.so" +FILES:libopencl-mesa-dev = "${libdir}/lib*OpenCL.so" FILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc" FILES:libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \ ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \
Signature · 1 line
2.39.5
Re: [OE-core] [PATCH v2 7/7] mesa: add support for RustiCL under PACKAGECONFIG "opencl"
meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch line 10
Quoted 7 lines · Dmitry Baryshkov via lists.openembedded.org
meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch new file +7
-0+Subject: [PATCH] rusticl: provide cross-compilation arguments to LLVM bindgen + invocation + +Correctly generating LLVM bindings requires several croos-compilation +arguments. Provide them to rust.bindgen(). + +Upstream-Status: Inappropriate [OE-Specific]
This patch does look like it should be submitted upstream.
Alex
Quoted 21 lines · Dmitry Baryshkov
libclc is required in order to build Intel drivers in Mesa 24.1 and later. Thus OE-Core is currently locked to the 24.0.x branch, which is no longer maintained, having last release in June 2024.
A clean solution is to package Clang, then use it to build libclc and SPIRV-LLVM-Translator (required for Mesa OpenCL support). However creating proper recipes for Clang is a long process (ongoing by Khem Raj).
This patchset attempts to solve the issue in a simpler way: by building libclc and SPIRV-LLVM-Translator together with the LLVM. This way we don't have to create target Clang recipes, there is no extra toolchain to support, etc. Clang binaries are creted as a part of the build process (in order to support building target packages), however it only hits the LLVM sysroot-native and is only used by the LLVM target build.
Future work by Khem (once Clang is properly supported in OE-Core) should allow us to create proper recipes for libclc and spirv-llvm-translator and drop them from the llvm / clang recipe.
Quoted 8 lines
I think this approach provides a good balance between OE-Core being stuck with the outdated Mesa release and being able to upgrade it, bringing support for new hardware.
Last two patches of the series bring in RustiCL support, a new OpenCL implementation within Mesa. They are optional for the sake of the upgrade and can be dropped if there is any issue with those. RustiCL support is mostly compile-tested at this point.
I took a look at the patchset, I don't have any particular objection to it. Since this is too late for walnascar release I think this will be considered for next release only atm. In that case, Since clang is also deferred until next release I wonder if we should do it along with clang merge into core but then I don't see big conflicts in there, it could even make mesa stable and a good litmus test for clang merge if that happens after it.
Quoted 52 lines
Changes since v1:
- DroppedYOCTO_ALTERNATE_LIBDIRpatch
- Reworked mesa / LLVM integration to always useget_option('libdir')
- Reenabled AMD Vulkan driver (got disabled because of c&p error)
- Moved mesa-clc options to the libclc PACKAGECONFIG to fix several build errorsSigned-off-by Dmitry Baryshkov <[email protected]>Dmitry Baryshkov (6):
llvm: move libLLVM.so.N.M to llvm-libllvm package
llvm: useOECMAKE_SOURCEPATHto specify cmake dir
llvm: support building libclc
llvm: add SPIRV-LLVM-Translator support
mesa: upgrade 24.0.7 -> 25.0.2
bindgen-cli: a tool to generate Rust bindingsZoltán Böszörményi (1):
mesa: add support for RustiCL under PACKAGECONFIG "opencl"meta/conf/distro/include/maintainers.inc | 1 + .../bindgen-cli/bindgen-cli-crates.inc | 186 ++++++++++++++++++ .../bindgen-cli/bindgen-cli_0.71.1.bb | 19 ++ ...ossCompile-pass-SPIR-V-headers-path-.patch | 40 ++++ .../llvm/llvm/fix-native-compilation.patch | 67 +++++++ .../llvm/llvm/spirv-internal-build.patch | 27 +++ meta/recipes-devtools/llvm/llvm_20.1.0.bb | 76 ++++++- ...-meson-do-not-pull-in-clc-for-clover.patch | 53 ----- ...lude-missing-llvm-IR-header-Module.h.patch | 41 ---- .../0001-drisw-fix-build-without-dri3.patch | 58 ------ ...on-t-encode-build-path-into-binaries.patch | 46 ++++- ...son-use-target-path-for-Clang-libdir.patch | 57 ++++++ ...cross-compilation-arguments-to-LLVM-.patch | 64 ++++++ ...on-t-try-zink-if-not-enabled-in-mesa.patch | 42 ---- meta/recipes-graphics/mesa/mesa.inc | 102 +++++----- 15 files changed, 625 insertions(+), 254 deletions(-) create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli-crates.inc create mode 100644 meta/recipes-devtools/bindgen-cli/bindgen-cli_0.71.1.bb create mode 100644 meta/recipes-devtools/llvm/llvm/0001-cmake-modules-CrossCompile-pass-SPIR-V-headers-path-.patch create mode 100644 meta/recipes-devtools/llvm/llvm/fix-native-compilation.patch create mode 100644 meta/recipes-devtools/llvm/llvm/spirv-internal-build.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-Revert-meson-do-not-pull-in-clc-for-clover.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-amd-Include-missing-llvm-IR-header-Module.h.patch delete mode 100644 meta/recipes-graphics/mesa/files/0001-drisw-fix-build-without-dri3.patch create mode 100644 meta/recipes-graphics/mesa/files/0001-meson-use-target-path-for-Clang-libdir.patch create mode 100644 meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch delete mode 100644 meta/recipes-graphics/mesa/files/0002-glxext-don-t-try-zink-if-not-enabled-in-mesa.patch--
2.39.5
Quoted 27 lines · Khem Raj
Quoted 25 lines · Dmitry Baryshkov
libclc is required in order to build Intel drivers in Mesa 24.1 and later. Thus OE-Core is currently locked to the 24.0.x branch, which is no longer maintained, having last release in June 2024.
A clean solution is to package Clang, then use it to build libclc and SPIRV-LLVM-Translator (required for Mesa OpenCL support). However creating proper recipes for Clang is a long process (ongoing by Khem Raj).
This patchset attempts to solve the issue in a simpler way: by building libclc and SPIRV-LLVM-Translator together with the LLVM. This way we don't have to create target Clang recipes, there is no extra toolchain to support, etc. Clang binaries are creted as a part of the build process (in order to support building target packages), however it only hits the LLVM sysroot-native and is only used by the LLVM target build.
Future work by Khem (once Clang is properly supported in OE-Core) should allow us to create proper recipes for libclc and spirv-llvm-translator and drop them from the llvm / clang recipe.
I think this approach provides a good balance between OE-Core being stuck with the outdated Mesa release and being able to upgrade it, bringing support for new hardware.
Quoted 8 lines
Quoted 4 lines
Last two patches of the series bring in RustiCL support, a new OpenCL implementation within Mesa. They are optional for the sake of the upgrade and can be dropped if there is any issue with those. RustiCL support is mostly compile-tested at this point.
I took a look at the patchset, I don't have any particular objection to it. Since this is too late for walnascar release I think this will be considered for next release only atm.
I was kind of hoping that this can get into walnascar, but it seems we missed the boat. I saw that the branch was created this night.
Quoted 2 lines
In that case, Since clang is also deferred until
next release I wonder if we should do it along with clang merge into core
As I wrote earlier, I think we should not be left with the outdated Mesa. Otherwise, we lack modern hardware support. I really fear that it will take several more months to land proper Clang support (sorry).
Quoted 2 lines
but then I don't see big conflicts in there, it could even make mesa stable and a good litmus test for clang merge if that happens after it.
I tried to stay as close as possible to the upcoming changes, as possible
Signature · 2 lines
With best wishes Dmitry
Quoted 3 lines · Dmitry Baryshkov via lists.openembedded.org
As I wrote earlier, I think we should not be left with the outdated Mesa. Otherwise, we lack modern hardware support. I really fear that it will take several more months to land proper Clang support (sorry).
Just to be clear, I fully support you here. Outdated mesa is starting to hurt the project. I only want the patches to be as high quality, well-documented, and maintainable as they can be.
Alex
Quoted 11 lines · Alexander Kanavin
Quoted 3 lines · Dmitry Baryshkov via lists.openembedded.org
As I wrote earlier, I think we should not be left with the outdated Mesa. Otherwise, we lack modern hardware support. I really fear that it will take several more months to land proper Clang support (sorry).
Just to be clear, I fully support you here. Outdated mesa is starting to hurt the project. I only want the patches to be as high quality, well-documented, and maintainable as they can be.
I know. I fully appreciate that.
Signature · 2 lines
With best wishes Dmitry
Quoted 29 lines · Dmitry Baryshkov via lists.openembedded.org
libclc is required in order to build Intel drivers in Mesa 24.1 and later. Thus OE-Core is currently locked to the 24.0.x branch, which is no longer maintained, having last release in June 2024.
A clean solution is to package Clang, then use it to build libclc and SPIRV-LLVM-Translator (required for Mesa OpenCL support). However creating proper recipes for Clang is a long process (ongoing by Khem Raj).
This patchset attempts to solve the issue in a simpler way: by building libclc and SPIRV-LLVM-Translator together with the LLVM. This way we don't have to create target Clang recipes, there is no extra toolchain to support, etc. Clang binaries are creted as a part of the build process (in order to support building target packages), however it only hits the LLVM sysroot-native and is only used by the LLVM target build.
Future work by Khem (once Clang is properly supported in OE-Core) should allow us to create proper recipes for libclc and spirv-llvm-translator and drop them from the llvm / clang recipe.
I think this approach provides a good balance between OE-Core being stuck with the outdated Mesa release and being able to upgrade it, bringing support for new hardware.
Last two patches of the series bring in RustiCL support, a new OpenCL implementation within Mesa. They are optional for the sake of the upgrade and can be dropped if there is any issue with those. RustiCL support is mostly compile-tested at this point.
Quoted 8 lines
Changes since v1:
- DroppedYOCTO_ALTERNATE_LIBDIRpatch
- Reworked mesa / LLVM integration to always useget_option('libdir')
- Reenabled AMD Vulkan driver (got disabled because of c&p error)
- Moved mesa-clc options to the libclc PACKAGECONFIG to fix several build errorsSigned-off-by Dmitry Baryshkov <[email protected]>
Hi,
Thanks for the v2, but it looks like we still have some issues on the autobuilder:
ERROR: nativesdk-mesa-2_25.0.2-r0 do_package_qa: QA Issue: File /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/dri/libdril_dri.so in package nativesdk-mesa-megadriver contains reference to TMPDIR [buildpaths]
ERROR: nativesdk-mesa-2_25.0.2-r0 do_package_qa: QA Issue: nativesdk-mesa-megadriver: /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/dri/libdril_dri.so contains bad RPATH /srv/pokybuild/yocto-worker/meta-intel/build/build/tmp/work/x86_64-linux/llvm-native/20.1.0/recipe-sysroot-native/usr/lib:/srv/pokybuild/yocto-worker/meta-intel/build/build/tmp/work/x86_64-linux/llvm-native/20.1.0/recipe-sysroot-native/lib [rpaths]
ERROR: nativesdk-mesa-2_25.0.2-r0 do_package_qa: QA Issue: File /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/libgallium-25.0.2.so in package nativesdk-libgallium contains reference to TMPDIR [buildpaths]
ERROR: nativesdk-mesa-2_25.0.2-r0 do_package_qa: QA Issue: nativesdk-libgallium: /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/libgallium-25.0.2.so contains bad RPATH /srv/pokybuild/yocto-worker/meta-intel/build/build/tmp/work/x86_64-linux/llvm-native/20.1.0/recipe-sysroot-native/usr/lib:/srv/pokybuild/yocto-worker/meta-intel/build/build/tmp/work/x86_64-linux/llvm-native/20.1.0/recipe-sysroot-native/lib [rpaths]
ERROR: nativesdk-mesa-2_25.0.2-r0 do_package_qa: Fatal QA errors were found, failing task.
https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/1288
https://autobuilder.yoctoproject.org/valkyrie/#/builders/2/builds/1289
Signature · 3 lines
Mathieu Dubois-Briand, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 44 lines · Mathieu Dubois-Briand
Quoted 29 lines · Dmitry Baryshkov via lists.openembedded.org
libclc is required in order to build Intel drivers in Mesa 24.1 and later. Thus OE-Core is currently locked to the 24.0.x branch, which is no longer maintained, having last release in June 2024.
A clean solution is to package Clang, then use it to build libclc and SPIRV-LLVM-Translator (required for Mesa OpenCL support). However creating proper recipes for Clang is a long process (ongoing by Khem Raj).
This patchset attempts to solve the issue in a simpler way: by building libclc and SPIRV-LLVM-Translator together with the LLVM. This way we don't have to create target Clang recipes, there is no extra toolchain to support, etc. Clang binaries are creted as a part of the build process (in order to support building target packages), however it only hits the LLVM sysroot-native and is only used by the LLVM target build.
Future work by Khem (once Clang is properly supported in OE-Core) should allow us to create proper recipes for libclc and spirv-llvm-translator and drop them from the llvm / clang recipe.
I think this approach provides a good balance between OE-Core being stuck with the outdated Mesa release and being able to upgrade it, bringing support for new hardware.
Last two patches of the series bring in RustiCL support, a new OpenCL implementation within Mesa. They are optional for the sake of the upgrade and can be dropped if there is any issue with those. RustiCL support is mostly compile-tested at this point.
Quoted 8 lines
Changes since v1:
- DroppedYOCTO_ALTERNATE_LIBDIRpatch
- Reworked mesa / LLVM integration to always useget_option('libdir')
- Reenabled AMD Vulkan driver (got disabled because of c&p error)
- Moved mesa-clc options to the libclc PACKAGECONFIG to fix several build errorsSigned-off-by Dmitry Baryshkov <[email protected]>Hi,
Thanks for the v2, but it looks like we still have some issues on the autobuilder:
Quoted 8 lines
ERROR: nativesdk-mesa-2_25.0.2-r0
do_package_qa: QA Issue: File/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/dri/libdril_dri.soin package nativesdk-mesa-megadriver contains reference to TMPDIR [buildpaths]
ERROR: nativesdk-mesa-2_25.0.2-r0do_package_qa: QA Issue: nativesdk-mesa-megadriver:/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/dri/libdril_dri.socontains bad RPATH /srv/pokybuild/yocto-worker/meta-intel/build/build/tmp/work/x86_64-linux/llvm-native/20.1.0/recipe-sysroot-native/usr/lib:/srv/pokybuild/yocto-worker/meta-intel/build/build/tmp/work/x86_64-linux/llvm-native/20.1.0/recipe-sysroot-native/lib [rpaths]
ERROR: nativesdk-mesa-2_25.0.2-r0do_package_qa: QA Issue: File/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/libgallium-25.0.2.soin package nativesdk-libgallium contains reference to TMPDIR [buildpaths]
ERROR: nativesdk-mesa-2_25.0.2-r0do_package_qa: QA Issue: nativesdk-libgallium:/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/libgallium-25.0.2.socontains bad RPATH /srv/pokybuild/yocto-worker/meta-intel/build/build/tmp/work/x86_64-linux/llvm-native/20.1.0/recipe-sysroot-native/usr/lib:/srv/pokybuild/yocto-worker/meta-intel/build/build/tmp/work/x86_64-linux/llvm-native/20.1.0/recipe-sysroot-native/lib [rpaths]
ERROR: nativesdk-mesa-2_25.0.2-r0do_package_qa: Fatal QA errors were found, failing task.https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/1288
https://autobuilder.yoctoproject.org/valkyrie/#/builders/2/builds/1289
I will take a look at the SDK builds, thanks!
Signature · 2 lines
With best wishes Dmitry