Skip to contentSkip to conversation

spirv-tools: fix INTERFACE_LINK_LIBRARIES cmake prop

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

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 spirv-tools: fix INTERFACE_LINK_LIBRARIES cmake prop

The output of spirv-tools specifically SPIRV-ToolsTarget.cmake is utilized in other recipes. If other recipe utilize cmake and include SPIRV-Tools in target_link_libraries. I leads to errors such as

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

This is due to cmake pulling in the properties set in SPIRV-ToolsTarget.cmake. Key property being INTERFACE_LINK_LIBRARIES.

With the current setup do_install:append:class-target updates SPIRV-ToolsTarget.cmake package installed file to bellow

set_target_properties(SPIRV-Tools PROPERTIES

    INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
    INTERFACE_LINK_LIBRARIES "${_IMPORT_PREFIX}/lib"

)

set_target_properties(SPIRV-Tools-shared PROPERTIES

    INTERFACE_COMPILE_DEFINITIONS "SPIRV_TOOLS_SHAREDLIB"
    INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
    INTERFACE_LINK_LIBRARIES "${_IMPORT_PREFIX}/lib"

)

If base_libdir isn't lib, but lib64 you get the error described at the being of commit message as lib directory doesn't exists.

Solution replace hardcoded "lib" with "${base_libdir}".

---
 meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/spir/spirv-tools_1.3.243.0.bb +1 -1
index c57acc5a11..21f9dd9650 100644
@@ -32,7 +32,7 @@ do_install:append:class-target() {
     # 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\}/lib":'
+        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}\${base_libdir}":'
 }
 
 # all the libraries are unversioned, so don't pack it on PN-dev
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 2/2 vulkan-validation-layers: add new recipe v1.3.243.0

Add a recipe to build the Khronos official Vulkan validation layers that can assist developers in verifying that their applications correctly use the Vulkan APIs.

---
 meta/conf/distro/include/maintainers.inc      |  1 +
 .../vulkan-validation-layers_1.3.243.0.bb     | 51 +++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb
meta/conf/distro/include/maintainers.inc +1 -0
index 0f7b7287bb..b06ae43dac 100644
@@ -827,6 +827,7 @@ RECIPE_MAINTAINER:pn-vulkan-headers = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-loader = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-samples = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-tools = "Anuj Mittal <[email protected]>"
+RECIPE_MAINTAINER:pn-vulkan-validation-layers = "Vincent Davis Jr <[email protected]>"
 RECIPE_MAINTAINER:pn-waffle = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-watchdog = "Alexander Kanavin <[email protected]>"
 RECIPE_MAINTAINER:pn-watchdog-config = "Alexander Kanavin <[email protected]>"
meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb new file +51 -0

51 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

Re: [OE-core] [PATCH v3 2/2] vulkan-validation-layers: add new recipe v1.3.243.0

I am seeing build failure on imx8 platform using clang.

https://errors.yoctoproject.org/Errors/Details/707981/

Quoted 93 lines · Vincent Davis Jr

Add a recipe to build the Khronos official Vulkan validation layers that can assist developers in verifying that their applications correctly use the Vulkan APIs.

---
 meta/conf/distro/include/maintainers.inc      |  1 +
 .../vulkan-validation-layers_1.3.243.0.bb     | 51 +++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb
meta/conf/distro/include/maintainers.inc +1 -0
index 0f7b7287bb..b06ae43dac 100644
@@ -827,6 +827,7 @@ RECIPE_MAINTAINER:pn-vulkan-headers = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-loader = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-samples = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-vulkan-tools = "Anuj Mittal <[email protected]>"
+RECIPE_MAINTAINER:pn-vulkan-validation-layers = "Vincent Davis Jr <[email protected]>"
 RECIPE_MAINTAINER:pn-waffle = "Ross Burton <[email protected]>"
 RECIPE_MAINTAINER:pn-watchdog = "Alexander Kanavin <[email protected]>"
 RECIPE_MAINTAINER:pn-watchdog-config = "Alexander Kanavin <[email protected]>"
meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb new file +51 -1
new file mode 100644
index 0000000000..6e1ef7a05d
@@ -0,0 +1,51 @@
+SUMMARY = "Vulkan Validation layers"
+DESCRIPTION = "Khronos official Vulkan validation layers to assist developers \
+in verifying that their applications correctly use the Vulkan API"
+HOMEPAGE = "https://www.khronos.org/vulkan/"
+BUGTRACKER = "https://github.com/KhronosGroup/Vulkan-ValidationLayers"
+SECTION = "libs"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=8df9e8826734226d08cb412babfa599c"
+
+SRC_URI = "git://[email protected]/KhronosGroup/Vulkan-ValidationLayers.git;branch=sdk-1.3.243;protocol=https"
+SRCREV = "4ac0fd8e6cb3d49105d707d9ec07f0f3aa0943d6"
+
+S = "${WORKDIR}/git"
+
+REQUIRED_DISTRO_FEATURES = "vulkan"
+
+DEPENDS = "vulkan-headers vulkan-loader spirv-headers spirv-tools glslang"
+
+# BUILD_TESTS            - Not required for OE builds
+# USE_ROBIN_HOOD_HASHING - Provides substantial performance improvements on all platforms.
+#                          Yocto project doesn't contain a recipe for package so disabled it.
+EXTRA_OECMAKE = "\
+    -DBUILD_TESTS=OFF \
+    -DUSE_ROBIN_HOOD_HASHING=OFF \
+    -DGLSLANG_INSTALL_DIR=${STAGING_DATADIR} \
+    -DVULKAN_HEADERS_INSTALL_DIR=${STAGING_EXECPREFIXDIR} \
+    -DSPIRV_HEADERS_INSTALL_DIR=${STAGING_EXECPREFIXDIR} \
+    "
+
+PACKAGECONFIG[x11] = "-DBUILD_WSI_XLIB_SUPPORT=ON -DBUILD_WSI_XCB_SUPPORT=ON, -DBUILD_WSI_XLIB_SUPPORT=OFF -DBUILD_WSI_XCB_SUPPORT=OFF, libxcb libx11 libxrandr"
+PACKAGECONFIG[wayland] = "-DBUILD_WSI_WAYLAND_SUPPORT=ON, -DBUILD_WSI_WAYLAND_SUPPORT=OFF, wayland"
+
+PACKAGECONFIG ?= "\
+    ${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)} \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'wayland', d)} \
+    "
+
+inherit cmake features_check pkgconfig
+
+FILES:${PN} += "${datadir}/vulkan ${libdir}"
+
+SOLIBS = ".so"
+FILES_SOLIBSDEV = ""
+
+# These recipes need to be updated in lockstep with each other:
+# glslang, vulkan-headers, vulkan-loader, vulkan-tools,
+# vulkan-validation-layers, spirv-headers, spirv-tools
+# The tags versions should always be sdk-x.y.z, as this is what
+# upstream considers a release.
+UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P<pver>\d+(\.\d+)+)"
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#182446): https://lists.openembedded.org/g/openembedded-core/message/182446
Mute This Topic: https://lists.openembedded.org/mt/99365321/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Re: [PATCH v3 2/2] vulkan-validation-layers: add new recipe v1.3.243.0

While I setup build environment for imx8 platform.

Does updating VULKAN_HEADERS_INSTALL_DIR to
-DVULKAN_HEADERS_INSTALL_DIR=${STAGING_DATADIR}
change anything?

#4 lore raw

Re: [OE-core] [PATCH v3 2/2] vulkan-validation-layers: add new recipe v1.3.243.0

Quoted 6 lines · Vincent Davis Jr

While I setup build environment for imx8 platform.

Does updating VULKAN_HEADERS_INSTALL_DIR to
-DVULKAN_HEADERS_INSTALL_DIR=${STAGING_DATADIR}
change anything?

Not much. Errors remains same.

Quoted 8 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#182529): https://lists.openembedded.org/g/openembedded-core/message/182529
Mute This Topic: https://lists.openembedded.org/mt/99365321/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw

Re: [PATCH v3 2/2] vulkan-validation-layers: add new recipe v1.3.243.0

Out of curiosity why does meta-freescale downgrade vulkan version to v1.2.182.0?

Either way adding vulkan-validation-layers_1.2.182.0.bb to
https://git.yoctoproject.org/meta-freescale/tree/recipes-downgrade/vulkan ( https://git.yoctoproject.org/meta-freescale/tree/recipes-downgrade/vulkan ) and
PREFERRED_VERSION_vulkan-validation-layers:imxvulkan ??= "1.2.182.0" to
https://git.yoctoproject.org/meta-freescale/tree/conf/machine/include/imx-base.inc
in meta-freescale. Fixes above error for me, but leads to.

vulkan-validation-layers/1.2.182.0-r0/git/layers/generated/chassis.cpp:383:10: error: variable 'skip' set but not used [-Werror,-Wunused-but-set-variable] |     bool skip = false;

#7 lore raw

Re: [OE-core] [PATCH v3 2/2] vulkan-validation-layers: add new recipe v1.3.243.0

seen more failures on qemux86 and qemumips

https://errors.yoctoproject.org/Errors/Details/708137/

Quoted 13 lines · Vincent Davis Jr

Created patch series should be fine to build now

1. https://lists.yoctoproject.org/g/meta-freescale/message/24918
2. https://lists.yoctoproject.org/g/meta-freescale/message/24919
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#182598): https://lists.openembedded.org/g/openembedded-core/message/182598
Mute This Topic: https://lists.openembedded.org/mt/99365321/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#8 lore raw

Re: [OE-core] [PATCH v3 2/2] vulkan-validation-layers: add new recipe v1.3.243.0

its failing on all qemu arches for me, so I looked a bit more into it, Some differences are that
my distro uses usrmerge feature and clang compiler. Secondly the error is because a spurious target
is added to generated makefiles which then fails.

| NOTE: cmake --build /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/vulkan-validation-layers/1.3.243.0-r0/build --target all --
| ninja: error:
'/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/vulkan-validation-layers/1.3.243.0-r0/recipe-sysroot/usr/usr/lib', needed by 'layers/libVkLayer_khronos_validation.so', missing and no
known rule to make it

seems to arise from autodetection of cmake modules, so somehow when
SPIRV-Tools target is added
then it ends up adding the bad target
LINK_LIBRARIES = layers/libVkLayer_utils.a /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/vulkan-validation-layers/1.3.243.0-r0/recipe-sysroot/usr/lib/libSPIRV-Tools.so
/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux/vulkan-validation-layers/1.3.243.0-r0/recipe-sysroot/usr/usr/lib

I narrowed it further down to

layers/CMakeLists.txt +1 -1
index 1a67fac2e..ffd031c62 100644
@@ -96,7 +96,7 @@ find_package(SPIRV-Headers REQUIRED CONFIG QUIET)
 target_link_libraries(VVL-SPIRV-LIBS INTERFACE SPIRV-Headers::SPIRV-Headers)
 
 find_package(SPIRV-Tools-opt REQUIRED CONFIG QUIET)
-target_link_libraries(VVL-SPIRV-LIBS INTERFACE SPIRV-Tools-opt)
+#target_link_libraries(VVL-SPIRV-LIBS INTERFACE SPIRV-Tools-opt)
 
 find_package(SPIRV-Tools REQUIRED CONFIG QUIET)
 
@@ -104,7 +104,7 @@ find_package(SPIRV-Tools REQUIRED CONFIG QUIET)
 # The targets available from SPIRV-Tools change depending on how

SPIRV_TOOLS_BUILD_STATIC is set.
# Try to handle all possible combinations so that we work with
externally built packages.
if (TARGET SPIRV-Tools)
- target_link_libraries(VVL-SPIRV-LIBS INTERFACE SPIRV-Tools)
+# target_link_libraries(VVL-SPIRV-LIBS INTERFACE SPIRV-Tools)
elseif(TARGET SPIRV-Tools-static)
target_link_libraries(VVL-SPIRV-LIBS INTERFACE SPIRV-Tools-static)
elseif(TARGET SPIRV-Tools-shared)

so it seems SPIRV-tools package might have this issue or something more to it.

you can reproduce this easily with yoe distro for any qemu target project.

Quoted 19 lines · Khem Raj

seen more failures on qemux86 and qemumips

https://errors.yoctoproject.org/Errors/Details/708137/

Quoted 13 lines · Vincent Davis Jr

Created patch series should be fine to build now

1. https://lists.yoctoproject.org/g/meta-freescale/message/24918
2. https://lists.yoctoproject.org/g/meta-freescale/message/24919
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#182598): https://lists.openembedded.org/g/openembedded-core/message/182598
Mute This Topic: https://lists.openembedded.org/mt/99365321/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#9 lore raw

Re: [PATCH v3 2/2] vulkan-validation-layers: add new recipe v1.3.243.0

Yeah, it's related to this issue here

https://lists.openembedded.org/g/openembedded-core/message/173249

And yeah vulkan-validation-layers cmake pulls in the properties set in SPIRV-ToolsTarget.cmake during the configure stage. The key cmake property being INTERFACE_LINK_LIBRARIES.

Commit message here should explain more
https://lists.openembedded.org/g/openembedded-core/message/182445

What's BASE_LIB set to on qemu machines? Thought process is that it's set to "usr/lib" and not "lib".

#10 lore raw

Re: [PATCH v3 2/2] vulkan-validation-layers: add new recipe v1.3.243.0

In reply to Khem Raj

Working to reproduce on my end to be sure it nothing more than changing BASE_LIB.

#11 lore raw

Re: [PATCH v3 2/2] vulkan-validation-layers: add new recipe v1.3.243.0

In reply to Khem Raj

Hey Khem,

Thanks, the perp seems to be usrmerge in distro features. Creating patch to account for it in spirv-tools recipe.