diff mbox series

[v2,2/2] mesa: Point to native llvm-config

Message ID 20230703025959.3968541-2-raj.khem@gmail.com
State New
Headers show
Series [v2,1/2] mesa: Fix build with upcoming LLVM 17 | expand

Commit Message

Khem Raj July 3, 2023, 2:59 a.m. UTC
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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-graphics/mesa/mesa.inc | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Alexander Kanavin July 3, 2023, 5:49 a.m. UTC | #1
But should this be fixed in meson class rather?

Alex

On Mon 3. Jul 2023 at 5.00, Khem Raj <raj.khem@gmail.com> wrote:

> 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
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-graphics/mesa/mesa.inc | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/meta/recipes-graphics/mesa/mesa.inc
> b/meta/recipes-graphics/mesa/mesa.inc
> index 928899008e6..63d7494dfc4 100644
> --- a/meta/recipes-graphics/mesa/mesa.inc
> +++ b/meta/recipes-graphics/mesa/mesa.inc
> @@ -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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Khem Raj July 3, 2023, 6:36 a.m. UTC | #2
On Sun, Jul 2, 2023 at 10:49 PM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> 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.

>
> Alex
>
> On Mon 3. Jul 2023 at 5.00, Khem Raj <raj.khem@gmail.com> wrote:
>>
>> 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
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  meta/recipes-graphics/mesa/mesa.inc | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
>> index 928899008e6..63d7494dfc4 100644
>> --- a/meta/recipes-graphics/mesa/mesa.inc
>> +++ b/meta/recipes-graphics/mesa/mesa.inc
>> @@ -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: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
Alexander Kanavin July 3, 2023, 6:49 a.m. UTC | #3
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

On Mon 3. Jul 2023 at 8.36, Khem Raj <raj.khem@gmail.com> wrote:

> On Sun, Jul 2, 2023 at 10:49 PM Alexander Kanavin
> <alex.kanavin@gmail.com> wrote:
> >
> > 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.
>
> >
> > Alex
> >
> > On Mon 3. Jul 2023 at 5.00, Khem Raj <raj.khem@gmail.com> wrote:
> >>
> >> 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
> >>
> >> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >> ---
> >>  meta/recipes-graphics/mesa/mesa.inc | 5 +++++
> >>  1 file changed, 5 insertions(+)
> >>
> >> diff --git a/meta/recipes-graphics/mesa/mesa.inc
> b/meta/recipes-graphics/mesa/mesa.inc
> >> index 928899008e6..63d7494dfc4 100644
> >> --- a/meta/recipes-graphics/mesa/mesa.inc
> >> +++ b/meta/recipes-graphics/mesa/mesa.inc
> >> @@ -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: openembedded-core+owner@lists.openembedded.org
> >> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alex.kanavin@gmail.com]
> >> -=-=-=-=-=-=-=-=-=-=-=-
> >>
>
Ross Burton July 4, 2023, 10:37 a.m. UTC | #4
On 3 Jul 2023, at 07:49, Alexander Kanavin via lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org> wrote:
> 
> 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
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 928899008e6..63d7494dfc4 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -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)} \