diff mbox series

spirv-tools: fix base_libdir when usrmerge in DISTRO_FEATURES

Message ID 20230611225342.1994556-1-vince@underview.tech
State New
Headers show
Series spirv-tools: fix base_libdir when usrmerge in DISTRO_FEATURES | expand

Commit Message

Vincent Davis Jr June 11, 2023, 10:53 p.m. UTC
if usrmerge included in DISTRO_FEATURES base_libdir is set to
"/usr/lib{64}" instead of "lib{64}". Build issues occur when
building vulkan-validation-layers or any recipe that
requires the output of spirv-tools (SPIRV-ToolsTarget.cmake).

As INTERFACE_LINK_LIBRARIES cmake property value is set incorrectly.
_IMPORT_PREFIX is already set to <recipes-sysroot>/usr
if usrmerge included INTERFACE_LINK_LIBRARIES value would be
<recipes-sysroot>/usr/usr/lib

Leading to bellow error

recipe-sysroot/usr/usr/lib', needed by 'layers/libVkLayer_khronos_validation.so',
missing and no known rule to make it

Solution:

Remove "/usr/" from base_libdir string if present as base_libdir
should only contain name of directory.

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
---
 meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Khem Raj June 12, 2023, 12:52 a.m. UTC | #1
On Sun, Jun 11, 2023 at 3:55 PM Vincent Davis Jr <vince@underview.tech> wrote:
>
> if usrmerge included in DISTRO_FEATURES base_libdir is set to
> "/usr/lib{64}" instead of "lib{64}". Build issues occur when
> building vulkan-validation-layers or any recipe that
> requires the output of spirv-tools (SPIRV-ToolsTarget.cmake).
>
> As INTERFACE_LINK_LIBRARIES cmake property value is set incorrectly.
> _IMPORT_PREFIX is already set to <recipes-sysroot>/usr
> if usrmerge included INTERFACE_LINK_LIBRARIES value would be
> <recipes-sysroot>/usr/usr/lib
>
> Leading to bellow error
>
> recipe-sysroot/usr/usr/lib', needed by 'layers/libVkLayer_khronos_validation.so',
> missing and no known rule to make it
>
> Solution:
>
> Remove "/usr/" from base_libdir string if present as base_libdir
> should only contain name of directory.
>
> Signed-off-by: Vincent Davis Jr <vince@underview.tech>
> ---
>  meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb b/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb
> index 21f9dd9650..dbfdbd4e0a 100644
> --- a/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb
> +++ b/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb
> @@ -28,11 +28,22 @@ EXTRA_OECMAKE += "\
>      -DSPIRV_SKIP_TESTS=ON \
>  "
>
> +# Removes "/usr/" from base_libdir if exist as
> +# it's already define in _IMPORT_PREFIX string
> +# leading to <recipes-sysroot>/usr/usr/lib not
> +# found as it doesn't exist.
> +def update_base_libdir(d):
> +    base_libdir=d.getVar("base_libdir")
> +    if '/usr/' in base_libdir:
> +        return base_libdir.strip("/usr/")
> +    return base_libdir
> +

baselib variable exists already. Please try to use that instead.

>  do_install:append:class-target() {
> +    baselibdir="${@update_base_libdir(d)}"
>      # Properly set _IMPORT_PREFIX in INTERFACE_LINK_LIBRARIES so that dependent
>      # tools can find the right library
>      sed -i ${D}${libdir}/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake \
> -        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}\${base_libdir}":'
> +        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}\${baselibdir}":'
>  }
>



>  # all the libraries are unversioned, so don't pack it on PN-dev
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#182641): https://lists.openembedded.org/g/openembedded-core/message/182641
> Mute This Topic: https://lists.openembedded.org/mt/99472427/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj June 12, 2023, 1:12 a.m. UTC | #2
something like this will be good

https://git.yoctoproject.org/poky-contrib/commit/?h=yoe/mut&id=98781287ec0e12d1dc3506f84871b47993c6750b

On Sun, Jun 11, 2023 at 5:52 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> On Sun, Jun 11, 2023 at 3:55 PM Vincent Davis Jr <vince@underview.tech> wrote:
> >
> > if usrmerge included in DISTRO_FEATURES base_libdir is set to
> > "/usr/lib{64}" instead of "lib{64}". Build issues occur when
> > building vulkan-validation-layers or any recipe that
> > requires the output of spirv-tools (SPIRV-ToolsTarget.cmake).
> >
> > As INTERFACE_LINK_LIBRARIES cmake property value is set incorrectly.
> > _IMPORT_PREFIX is already set to <recipes-sysroot>/usr
> > if usrmerge included INTERFACE_LINK_LIBRARIES value would be
> > <recipes-sysroot>/usr/usr/lib
> >
> > Leading to bellow error
> >
> > recipe-sysroot/usr/usr/lib', needed by 'layers/libVkLayer_khronos_validation.so',
> > missing and no known rule to make it
> >
> > Solution:
> >
> > Remove "/usr/" from base_libdir string if present as base_libdir
> > should only contain name of directory.
> >
> > Signed-off-by: Vincent Davis Jr <vince@underview.tech>
> > ---
> >  meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb | 13 ++++++++++++-
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb b/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb
> > index 21f9dd9650..dbfdbd4e0a 100644
> > --- a/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb
> > +++ b/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb
> > @@ -28,11 +28,22 @@ EXTRA_OECMAKE += "\
> >      -DSPIRV_SKIP_TESTS=ON \
> >  "
> >
> > +# Removes "/usr/" from base_libdir if exist as
> > +# it's already define in _IMPORT_PREFIX string
> > +# leading to <recipes-sysroot>/usr/usr/lib not
> > +# found as it doesn't exist.
> > +def update_base_libdir(d):
> > +    base_libdir=d.getVar("base_libdir")
> > +    if '/usr/' in base_libdir:
> > +        return base_libdir.strip("/usr/")
> > +    return base_libdir
> > +
>
> baselib variable exists already. Please try to use that instead.
>
> >  do_install:append:class-target() {
> > +    baselibdir="${@update_base_libdir(d)}"
> >      # Properly set _IMPORT_PREFIX in INTERFACE_LINK_LIBRARIES so that dependent
> >      # tools can find the right library
> >      sed -i ${D}${libdir}/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake \
> > -        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}\${base_libdir}":'
> > +        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}\${baselibdir}":'
> >  }
> >
>
>
>
> >  # all the libraries are unversioned, so don't pack it on PN-dev
> > --
> > 2.34.1
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#182641): https://lists.openembedded.org/g/openembedded-core/message/182641
> > Mute This Topic: https://lists.openembedded.org/mt/99472427/1997914
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
Vincent Davis Jr June 12, 2023, 2:17 a.m. UTC | #3
Just tried that builds for me.
Khem Raj June 12, 2023, 2:36 a.m. UTC | #4
On Sun, Jun 11, 2023 at 7:17 PM Vincent Davis Jr <vince@underview.tech> wrote:
>
> Just tried that builds for me.

cool. Then please send a v2 of your patch series using that patch.

> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#182647): https://lists.openembedded.org/g/openembedded-core/message/182647
> Mute This Topic: https://lists.openembedded.org/mt/99472427/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb b/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb
index 21f9dd9650..dbfdbd4e0a 100644
--- a/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb
+++ b/meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb
@@ -28,11 +28,22 @@  EXTRA_OECMAKE += "\
     -DSPIRV_SKIP_TESTS=ON \
 "
 
+# Removes "/usr/" from base_libdir if exist as
+# it's already define in _IMPORT_PREFIX string
+# leading to <recipes-sysroot>/usr/usr/lib not
+# found as it doesn't exist.
+def update_base_libdir(d):
+    base_libdir=d.getVar("base_libdir")
+    if '/usr/' in base_libdir:
+        return base_libdir.strip("/usr/")
+    return base_libdir
+
 do_install:append:class-target() {
+    baselibdir="${@update_base_libdir(d)}"
     # Properly set _IMPORT_PREFIX in INTERFACE_LINK_LIBRARIES so that dependent
     # tools can find the right library
     sed -i ${D}${libdir}/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake \
-        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}\${base_libdir}":'
+        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}\${baselibdir}":'
 }
 
 # all the libraries are unversioned, so don't pack it on PN-dev