mesa: Fix build with upcoming LLVM 17
PATCH v2 1/2 mesa: Fix build with upcoming LLVM 17
--- .../0001-gallium-Fix-build-with-llvm-17.patch | 34 +++++++++++++++++++ meta/recipes-graphics/mesa/mesa.inc | 1 + 2 files changed, 35 insertions(+) create mode 100644 meta/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch
meta/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch new file +34 -0
@@ -0,0 +1,34 @@ +From 865762e0a767a121206d818bdd58301afbf30104 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Fri, 23 Jun 2023 01:20:38 -0700 +Subject: [PATCH] gallium: Fix build with llvm 17 + +These headers are not available for C files in llvm 17+ +and they seem to be not needed to compile after all with llvm 17 +so add conditions to exclude them for llvm >= 17 + +Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23827] +Signed-off-by: Khem Raj <[email protected]> +--- + src/gallium/auxiliary/gallivm/lp_bld_init.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c +index 24d0823..3d4573e 100644 +--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c ++++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c +@@ -42,8 +42,10 @@ + + #include <llvm/Config/llvm-config.h> + #include <llvm-c/Analysis.h> ++#if LLVM_VERSION_MAJOR < 17 + #include <llvm-c/Transforms/Scalar.h> +-#if LLVM_VERSION_MAJOR >= 7 ++#endif ++#if LLVM_VERSION_MAJOR >= 7 && LLVM_VERSION_MAJOR < 17 + #include <llvm-c/Transforms/Utils.h> + #endif + #include <llvm-c/BitWriter.h> +-- +2.41.0 +
meta/recipes-graphics/mesa/mesa.inc +1 -0
@@ -17,6 +17,7 @@ PE = "2" SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \ file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \ file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ + file://0001-gallium-Fix-build-with-llvm-17.patch \ " SRC_URI[sha256sum] = "2f6d7381bc10fbd2d6263ad1022785b8b511046c1a904162f8f7da18eea8aed9"
Signature · 1 line
2.41.0
PATCH v2 2/2 mesa: Point to native llvm-config
Default search in meson would grok /usr/bin for llvm-config and if found will use it, which might add wrong paths into cflags/ldflags, since we depend on llvm-native when building gallium support ( thats when llvm-config is effective), its better to point llvm-config into native sysroot so it can add correct paths into compiler/linker cmdline
--- meta/recipes-graphics/mesa/mesa.inc | 5 +++++ 1 file changed, 5 insertions(+)
meta/recipes-graphics/mesa/mesa.inc +5 -0
@@ -75,6 +75,11 @@ EXTRA_OEMESON = " \ def strip_comma(s): return s.strip(',') +# llvm-config should be the one from llvm-native and not from build host ( if llvm is installed on host ) +do_write_config:append() { + sed -i -e '/\[binaries\]/a\' -e "llvm-config = '${STAGING_BINDIR_NATIVE}/llvm-config'" ${WORKDIR}/meson.native +} + PACKAGECONFIG = " \ gallium \ ${@bb.utils.filter('DISTRO_FEATURES', 'x11 vulkan wayland', d)} \
Signature · 1 line
2.41.0
Re: [OE-core] [PATCH v2 2/2] mesa: Point to native llvm-config
But should this be fixed in meson class rather?
Alex
Quoted 45 lines · Khem Raj
Default search in meson would grok
/usr/binfor llvm-config and if found will use it, which might add wrong paths into cflags/ldflags, since we depend on llvm-native when building gallium support ( thats when llvm-config is effective), its better to point llvm-config into native sysroot so it can add correct paths into compiler/linker cmdlineSigned-off-by Khem Raj <[email protected]>--- meta/recipes-graphics/mesa/mesa.inc | 5 +++++ 1 file changed, 5 insertions(+)meta/recipes-graphics/mesa/mesa.inc +3
-0@@ -75,6 +75,11 @@ EXTRA_OEMESON = " \ def strip_comma(s): return s.strip(',') +# llvm-config should be the one from llvm-native and not from build host ( if llvm is installed on host ) +do_write_config:append() { + sed -i -e '/\[binaries\]/a\' -e "llvm-config ='${STAGING_BINDIR_NATIVE}/llvm-config'" ${WORKDIR}/meson.native
meta/recipes-graphics/mesa/mesa.inc +2
-1+} + PACKAGECONFIG = " \ gallium \ ${@bb.utils.filter('DISTRO_FEATURES', 'x11 vulkan wayland', d)} \ --2.41.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#183787):
https://lists.openembedded.org/g/openembedded-core/message/183787
Mute This Topic: https://lists.openembedded.org/mt/99920489/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [OE-core] [PATCH v2 2/2] mesa: Point to native llvm-config
Quoted 2 lines · Alexander Kanavin
But should this be fixed in meson class rather?
I am not sure, llvm-native is not so common yet as a dependency. When it becomes we can revisit.
Quoted 44 lines
Alex
Quoted 40 lines · Khem Raj
Default search in meson would grok
/usr/binfor llvm-config and if found will use it, which might add wrong paths into cflags/ldflags, since we depend on llvm-native when building gallium support ( thats when llvm-config is effective), its better to point llvm-config into native sysroot so it can add correct paths into compiler/linker cmdlineSigned-off-by Khem Raj <[email protected]>--- meta/recipes-graphics/mesa/mesa.inc | 5 +++++ 1 file changed, 5 insertions(+)meta/recipes-graphics/mesa/mesa.inc +5
-1@@ -75,6 +75,11 @@ EXTRA_OEMESON = " \ def strip_comma(s): return s.strip(',') +# llvm-config should be the one from llvm-native and not from build host ( if llvm is installed on host ) +do_write_config:append() { + sed -i -e '/\[binaries\]/a\' -e "llvm-config = '${STAGING_BINDIR_NATIVE}/llvm-config'" ${WORKDIR}/meson.native +} + PACKAGECONFIG = " \ gallium \ ${@bb.utils.filter('DISTRO_FEATURES', 'x11 vulkan wayland', d)} \ --2.41.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#183787): https://lists.openembedded.org/g/openembedded-core/message/183787
Mute This Topic: https://lists.openembedded.org/mt/99920489/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [OE-core] [PATCH v2 2/2] mesa: Point to native llvm-config
I would rather fix it in the class from the start. Sed hacks like that tend to obscure the original problem and/or quietly regress.
Alex
Quoted 59 lines · Khem Raj
Quoted 2 lines · Alexander Kanavin
But should this be fixed in meson class rather?
I am not sure, llvm-native is not so common yet as a dependency. When it becomes we can revisit.
Quoted 11 lines
Alex
Quoted 7 lines · Khem Raj
Default search in meson would grok
/usr/binfor llvm-config and if found will use it, which might add wrong paths into cflags/ldflags, since we depend on llvm-native when building gallium support ( thats when llvm-config is effective), its better to point llvm-config into native sysroot so it can add correct paths into compiler/linker cmdlineQuoted 6 lines
Review
Quoted 6 lines
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-graphics/mesa/mesa.inc | 5 +++++ 1 file changed, 5 insertions(+)(quoted diff) +0
-0b/meta/recipes-graphics/mesa/mesa.inc
Quoted 8 lines
meta/recipes-graphics/mesa/mesa.inc EXTRA_OEMESON = " \ · line 78
Quoted 8 lines
index
928899008e6..63d7494dfc4100644meta/recipes-graphics/mesa/mesa.inc +1
-0@@ -75,6 +75,11 @@ EXTRA_OEMESON = " \ def strip_comma(s): return s.strip(',') +# llvm-config should be the one from llvm-native and not from buildhost ( if llvm is installed on host )
Quoted 2 lines
meta/recipes-graphics/mesa/mesa.inc EXTRA_OEMESON = " \ · line 80
Quoted 2 lines
meta/recipes-graphics/mesa/mesa.inc +2
-0+do_write_config:append() { + sed -i -e '/\[binaries\]/a\' -e "llvm-config ='${STAGING_BINDIR_NATIVE}/llvm-config'" ${WORKDIR}/meson.native
Quoted 5 lines
meta/recipes-graphics/mesa/mesa.inc EXTRA_OEMESON = " \
Quoted 5 lines
meta/recipes-graphics/mesa/mesa.inc +2
-0+} + PACKAGECONFIG = " \ gallium \ ${@bb.utils.filter('DISTRO_FEATURES', 'x11 vulkan wayland', d)}\
Quoted 7 lines
Quoted 7 lines
--
2.41.0-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#183787):https://lists.openembedded.org/g/openembedded-core/message/183787
Quoted 3 lines
Quoted 3 lines
Mute This Topic: https://lists.openembedded.org/mt/99920489/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [Quoted 2 lines
Quoted 2 lines
-=-=-=-=-=-=-=-=-=-=-=-
Re: [OE-core] [PATCH v2 2/2] mesa: Point to native llvm-config
Quoted 2 lines · Alexander Kanavin via lists.openembedded.org
I would rather fix it in the class from the start. Sed hacks like that tend to obscure the original problem and/or quietly regress.
Agreed. Let’s do this in meson.bbclass and then recipes that use llvm but don’t depend on it won’t find the host llvm.
Ross