Skip to contentSkip to conversation

spirv-tools: fix base_libdir when usrmerge in DISTRO_FEATURES

PATCH In review Vincent Davis Jr 2 participants 5 messages Jun 11, 2023 – Jun 12, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spirv-tools: fix base_libdir when usrmerge in DISTRO_FEATURES

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.

---
 meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb +12 -1
index 21f9dd9650..dbfdbd4e0a 100644
@@ -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
Signature · 1 line
2.34.1
#1 lore raw
Quoted 34 lines · Vincent Davis Jr

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.

---
 meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb +0 -0
index 21f9dd9650..dbfdbd4e0a 100644
@@ -28,11 +28,22 @@ EXTRA_OECMAKE += "\
     -DSPIRV_SKIP_TESTS=ON \
 "
 

meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb EXTRA_OECMAKE += "\ · line 40

Quoted 10 lines
meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb +10 -0
+# 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.

Quoted 25 lines
meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb +2 -1
 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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

something like this will be good

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

Quoted 74 lines · Khem Raj
Quoted 34 lines · Vincent Davis Jr

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.

---
 meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb +0 -0
index 21f9dd9650..dbfdbd4e0a 100644
@@ -28,11 +28,22 @@ EXTRA_OECMAKE += "\
     -DSPIRV_SKIP_TESTS=ON \
 "
 

meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb EXTRA_OECMAKE += "\ · line 40

Quoted 10 lines
meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb +10 -0
+# 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.

Quoted 25 lines
meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb +2 -1
 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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
Quoted 2 lines · Vincent Davis Jr

Just tried that builds for me.

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

Quoted 8 lines

-=-=-=-=-=-=-=-=-=-=-=-
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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-