diff mbox series

[1/3] spirv-tools: Correctly set the prefix in exported cmake packages

Message ID 20221110204232.12768-2-jorcrous@amazon.com
State New
Headers show
Series Add vulkan validation and improvements for headless devices | expand

Commit Message

Jordan Crouse Nov. 10, 2022, 8:42 p.m. UTC
spirv-tools exports Cmake packages.  When they are installed the
INTERFACE_LINK_LIBRARIES variable is not correctly updated to use
_IMPORT_PREFIX like the other variables. This may have something to do with
the path to the sysroot being different than the source path.

The existing recipe recognizes that the sysroot path made it through to the
install and tries to get rid of it, but this just ends up with dependent
tools looking in vain for /usr/lib/librt.so.

Replace the INTERFACE_LINK_LIBRARIES value in SPIRV-ToolsTarget.cmake with
"${IMPORT_PREFIX}/lib".

Signed-off-by: Jordan Crouse <jorcrous@amazon.com>
---

 meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Khem Raj Nov. 10, 2022, 8:43 p.m. UTC | #1
On Thu, Nov 10, 2022 at 12:42 PM Jordan Crouse via
lists.openembedded.org <jorcrous=amazon.com@lists.openembedded.org>
wrote:
>
> spirv-tools exports Cmake packages.  When they are installed the
> INTERFACE_LINK_LIBRARIES variable is not correctly updated to use
> _IMPORT_PREFIX like the other variables. This may have something to do with
> the path to the sysroot being different than the source path.
>
> The existing recipe recognizes that the sysroot path made it through to the
> install and tries to get rid of it, but this just ends up with dependent
> tools looking in vain for /usr/lib/librt.so.
>
> Replace the INTERFACE_LINK_LIBRARIES value in SPIRV-ToolsTarget.cmake with
> "${IMPORT_PREFIX}/lib".
>
> Signed-off-by: Jordan Crouse <jorcrous@amazon.com>
> ---
>
>  meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb b/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
> index ea47796543..fdc9c9225a 100644
> --- a/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
> +++ b/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
> @@ -10,6 +10,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
>  SRCREV = "eb0a36633d2acf4de82588504f951ad0f2cecacb"
>  SRC_URI = "git://github.com/KhronosGroup/SPIRV-Tools.git;branch=master;protocol=https"
>  PE = "1"
> +PR = "r1"

We no longer bump the PR manually. So this is not needed.

> +
>  UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P<pver>\d+(\.\d+)+)"
>  S = "${WORKDIR}/git"
>
> @@ -25,9 +27,10 @@ EXTRA_OECMAKE += "\
>  "
>
>  do_install:append:class-target() {
> -    # reproducibility: remove build host path
> +    # 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:${STAGING_DIR_HOST}::g'
> +        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}/lib":'
>  }
>
>  # all the libraries are unversioned, so don't pack it on PN-dev
> --
> 2.37.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#173108): https://lists.openembedded.org/g/openembedded-core/message/173108
> Mute This Topic: https://lists.openembedded.org/mt/94945230/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Jose Quaresma Nov. 11, 2022, 10:44 a.m. UTC | #2
Jordan Crouse via lists.openembedded.org <jorcrous=
amazon.com@lists.openembedded.org> escreveu no dia quinta, 10/11/2022 à(s)
20:42:

> spirv-tools exports Cmake packages.  When they are installed the
> INTERFACE_LINK_LIBRARIES variable is not correctly updated to use
> _IMPORT_PREFIX like the other variables. This may have something to do with
> the path to the sysroot being different than the source path.
>
> The existing recipe recognizes that the sysroot path made it through to the
> install and tries to get rid of it, but this just ends up with dependent
> tools looking in vain for /usr/lib/librt.so.
>
> Replace the INTERFACE_LINK_LIBRARIES value in SPIRV-ToolsTarget.cmake with
> "${IMPORT_PREFIX}/lib".
>
> Signed-off-by: Jordan Crouse <jorcrous@amazon.com>
> ---
>
>  meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
> b/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
> index ea47796543..fdc9c9225a 100644
> --- a/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
> +++ b/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
> @@ -10,6 +10,8 @@ LIC_FILES_CHKSUM =
> "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
>  SRCREV = "eb0a36633d2acf4de82588504f951ad0f2cecacb"
>  SRC_URI = "git://
> github.com/KhronosGroup/SPIRV-Tools.git;branch=master;protocol=https"
>  PE = "1"
> +PR = "r1"
> +
>  UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P<pver>\d+(\.\d+)+)"
>  S = "${WORKDIR}/git"
>
> @@ -25,9 +27,10 @@ EXTRA_OECMAKE += "\
>  "
>
>  do_install:append:class-target() {
> -    # reproducibility: remove build host path
> +    # 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:${STAGING_DIR_HOST}::g'
> +        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES
> "\$\{_IMPORT_PREFIX\}/lib":'
>

As this change don't use any bitbake variable can it be done patching the
cmake source file?

Jose


>  }
>
>  # all the libraries are unversioned, so don't pack it on PN-dev
> --
> 2.37.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#173108):
> https://lists.openembedded.org/g/openembedded-core/message/173108
> Mute This Topic: https://lists.openembedded.org/mt/94945230/5052612
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> quaresma.jose@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb b/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
index ea47796543..fdc9c9225a 100644
--- a/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
+++ b/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
@@ -10,6 +10,8 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
 SRCREV = "eb0a36633d2acf4de82588504f951ad0f2cecacb"
 SRC_URI = "git://github.com/KhronosGroup/SPIRV-Tools.git;branch=master;protocol=https"
 PE = "1"
+PR = "r1"
+
 UPSTREAM_CHECK_GITTAGREGEX = "sdk-(?P<pver>\d+(\.\d+)+)"
 S = "${WORKDIR}/git"
 
@@ -25,9 +27,10 @@  EXTRA_OECMAKE += "\
 "
 
 do_install:append:class-target() {
-    # reproducibility: remove build host path
+    # 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:${STAGING_DIR_HOST}::g'
+        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}/lib":'
 }
 
 # all the libraries are unversioned, so don't pack it on PN-dev