diff mbox series

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

Message ID 20230606151335.6019-2-vince@underview.tech
State New
Headers show
Series [v3,1/2] spirv-tools: fix INTERFACE_LINK_LIBRARIES cmake prop | expand

Commit Message

Vincent Davis Jr June 6, 2023, 3:13 p.m. UTC
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.

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
---
 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

Comments

Khem Raj June 9, 2023, 2:11 a.m. UTC | #1
I am seeing build failure on imx8 platform using clang.

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

On Tue, Jun 6, 2023 at 8:14 AM Vincent Davis Jr <vince@underview.tech> wrote:
>
> 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.
>
> Signed-off-by: Vincent Davis Jr <vince@underview.tech>
> ---
>  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
>
> diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
> index 0f7b7287bb..b06ae43dac 100644
> --- a/meta/conf/distro/include/maintainers.inc
> +++ b/meta/conf/distro/include/maintainers.inc
> @@ -827,6 +827,7 @@ RECIPE_MAINTAINER:pn-vulkan-headers = "Anuj Mittal <anuj.mittal@intel.com>"
>  RECIPE_MAINTAINER:pn-vulkan-loader = "Anuj Mittal <anuj.mittal@intel.com>"
>  RECIPE_MAINTAINER:pn-vulkan-samples = "Ross Burton <ross.burton@arm.com>"
>  RECIPE_MAINTAINER:pn-vulkan-tools = "Anuj Mittal <anuj.mittal@intel.com>"
> +RECIPE_MAINTAINER:pn-vulkan-validation-layers = "Vincent Davis Jr <vince@underview.tech>"
>  RECIPE_MAINTAINER:pn-waffle = "Ross Burton <ross.burton@arm.com>"
>  RECIPE_MAINTAINER:pn-watchdog = "Alexander Kanavin <alex.kanavin@gmail.com>"
>  RECIPE_MAINTAINER:pn-watchdog-config = "Alexander Kanavin <alex.kanavin@gmail.com>"
> diff --git a/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb b/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb
> new file mode 100644
> index 0000000000..6e1ef7a05d
> --- /dev/null
> +++ b/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb
> @@ -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://git@github.com/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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Vincent Davis Jr June 9, 2023, 5:20 a.m. UTC | #2
While I setup build environment for imx8 platform.

Does updating VULKAN_HEADERS_INSTALL_DIR to
-DVULKAN_HEADERS_INSTALL_DIR=${STAGING_DATADIR}
change anything?
Khem Raj June 9, 2023, 5:58 a.m. UTC | #3
On Thu, Jun 8, 2023 at 10:20 PM Vincent Davis Jr <vince@underview.tech> wrote:
>
> 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.

> -=-=-=-=-=-=-=-=-=-=-=-
> 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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Vincent Davis Jr June 9, 2023, 6:41 p.m. UTC | #4
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;
Vincent Davis Jr June 9, 2023, 8:57 p.m. UTC | #5
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
Khem Raj June 11, 2023, 6:55 a.m. UTC | #6
seen more failures on qemux86 and qemumips

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

On Fri, Jun 9, 2023 at 1:57 PM Vincent Davis Jr <vince@underview.tech> wrote:
>
> 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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj June 11, 2023, 4:39 p.m. UTC | #7
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

diff --git a/layers/CMakeLists.txt b/layers/CMakeLists.txt
index 1a67fac2e..ffd031c62 100644
--- a/layers/CMakeLists.txt
+++ b/layers/CMakeLists.txt
@@ -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.



On Sat, Jun 10, 2023 at 11:55 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> seen more failures on qemux86 and qemumips
>
> https://errors.yoctoproject.org/Errors/Details/708137/
>
> On Fri, Jun 9, 2023 at 1:57 PM Vincent Davis Jr <vince@underview.tech> wrote:
> >
> > 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: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
Vincent Davis Jr June 11, 2023, 5:53 p.m. UTC | #8
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".
Vincent Davis Jr June 11, 2023, 5:56 p.m. UTC | #9
Working to reproduce on my end to be sure it nothing more than changing BASE_LIB.
Vincent Davis Jr June 11, 2023, 8:30 p.m. UTC | #10
Hey Khem,

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

Patch

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index 0f7b7287bb..b06ae43dac 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -827,6 +827,7 @@  RECIPE_MAINTAINER:pn-vulkan-headers = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER:pn-vulkan-loader = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER:pn-vulkan-samples = "Ross Burton <ross.burton@arm.com>"
 RECIPE_MAINTAINER:pn-vulkan-tools = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-vulkan-validation-layers = "Vincent Davis Jr <vince@underview.tech>"
 RECIPE_MAINTAINER:pn-waffle = "Ross Burton <ross.burton@arm.com>"
 RECIPE_MAINTAINER:pn-watchdog = "Alexander Kanavin <alex.kanavin@gmail.com>"
 RECIPE_MAINTAINER:pn-watchdog-config = "Alexander Kanavin <alex.kanavin@gmail.com>"
diff --git a/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb b/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb
new file mode 100644
index 0000000000..6e1ef7a05d
--- /dev/null
+++ b/meta/recipes-graphics/vulkan/vulkan-validation-layers_1.3.243.0.bb
@@ -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://git@github.com/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+)+)"