[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#951988: libplacebo: FTBFS: (.text+0x8ee): undefined reference to `spvContextCreate'



On Mon, 18 Jan 2021 at 11:27:35 +0000, Simon McVittie wrote:
> On Mon, 18 Jan 2021 at 10:54:30 +0000, Simon McVittie wrote:
> > Unfortunately, unlike #980369, I was not able to find a combination of
> > libraries that I could add to spirv.pc to fix this bug.
> 
> I think the attached might do it? As before, I don't know this library,
> so please review carefully.
> 
> I have deliberately not used SPIRV-Tools-Shared here to avoid being
> affected by #980370.

https://salsa.debian.org/xorg-team/vulkan/glslang/-/merge_requests/4

(Updated patches attached, if you prefer the BTS.)

    smcv
>From af942e4bc20bdb9fab9f187f497e7fe6c80cf12d Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 18 Jan 2021 11:24:30 +0000
Subject: [PATCH 1/2] Add missing dependencies to spirv.pc

Some code accessed via spirv.pc requires SPIRV-Tools and/or glslang.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Closes: #951988
---
 debian/control                                |  3 +-
 debian/patches/series                         |  1 +
 ...endencies-on-SPIRV-Tools-and-glslang.patch | 38 +++++++++++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 debian/patches/spirv.pc-Add-dependencies-on-SPIRV-Tools-and-glslang.patch

diff --git a/debian/control b/debian/control
index 594ac5a8..6eacf228 100644
--- a/debian/control
+++ b/debian/control
@@ -28,7 +28,8 @@ Description: OpenGL and OpenGL ES shader front end and validator -- tools
 
 Package: glslang-dev
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends},
+ spirv-tools,
 Suggests: glslang-tools
 Multi-Arch: same
 Description: OpenGL and OpenGL ES shader front end and validator -- development files
diff --git a/debian/patches/series b/debian/patches/series
index 7d0b1f9a..e66d681a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 glslang-default-resource-limits_staticlib.patch
 0001-pkg-config-compatibility.patch
 glslang.pc-Add-missing-libraries.patch
+spirv.pc-Add-dependencies-on-SPIRV-Tools-and-glslang.patch
diff --git a/debian/patches/spirv.pc-Add-dependencies-on-SPIRV-Tools-and-glslang.patch b/debian/patches/spirv.pc-Add-dependencies-on-SPIRV-Tools-and-glslang.patch
new file mode 100644
index 00000000..160832d6
--- /dev/null
+++ b/debian/patches/spirv.pc-Add-dependencies-on-SPIRV-Tools-and-glslang.patch
@@ -0,0 +1,38 @@
+From: Simon McVittie <smcv@collabora.com>
+Date: Mon, 18 Jan 2021 11:22:34 +0000
+Subject: spirv.pc: Add dependencies on SPIRV-Tools and glslang
+
+Otherwise, a simple program like this will fail to link:
+
+    #include <glslang/SPIRV/GlslangToSpv.h>
+    int main (void)
+    {
+      std::string s;
+      glslang::GetSpirvVersion(s);
+      return 0;
+    }
+
+when compiled with the obvious parameters from pkg-config:
+
+    g++ -ospirv spirv.cpp $(pkg-config --cflags --libs spirv)
+
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=951988
+Signed-off-by: Simon McVittie <smcv@collabora.com>
+---
+ SPIRV/spirv.pc.cmake.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/SPIRV/spirv.pc.cmake.in b/SPIRV/spirv.pc.cmake.in
+index dfcad94..d47d427 100644
+--- a/SPIRV/spirv.pc.cmake.in
++++ b/SPIRV/spirv.pc.cmake.in
+@@ -5,7 +5,7 @@
+     
+     Name: @SPIRV_NAME@
+     Description: SPIR-V is a binary intermediate language for representing graphical-shader stages and compute kernels for multiple Khronos APIs, including OpenCL, OpenGL, and Vulkan
+-    Requires:
++    Requires: SPIRV-Tools, glslang
+     Version: @SPIRV_VERSION@
+     Libs: -L${libdir} -lSPIRV
+     Cflags: -I${includedir}
+\ No newline at end of file
-- 
2.30.1

>From ff5bf4e4301419d16f68a5ca673dc1c88c3f3c1f Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 18 Jan 2021 10:16:45 +0000
Subject: [PATCH 2/2] d/tests/glslang-dev: Add a test for spirv.pc

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reproduces: #951988
---
 .../glslang.pc-Add-missing-libraries.patch       |  2 +-
 debian/tests/glslang-dev                         | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/debian/patches/glslang.pc-Add-missing-libraries.patch b/debian/patches/glslang.pc-Add-missing-libraries.patch
index f8029af4..b3fa7b4f 100644
--- a/debian/patches/glslang.pc-Add-missing-libraries.patch
+++ b/debian/patches/glslang.pc-Add-missing-libraries.patch
@@ -11,7 +11,7 @@ Signed-off-by: Simon McVittie <smcv@collabora.com>
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/glslang/glslang.pc.cmake.in b/glslang/glslang.pc.cmake.in
-index 921497e..fd92606 100644
+index 921497e..8c49e0c 100644
 --- a/glslang/glslang.pc.cmake.in
 +++ b/glslang/glslang.pc.cmake.in
 @@ -7,5 +7,5 @@
diff --git a/debian/tests/glslang-dev b/debian/tests/glslang-dev
index 3f6af04a..bf103ca0 100755
--- a/debian/tests/glslang-dev
+++ b/debian/tests/glslang-dev
@@ -35,6 +35,17 @@ int main (void)
 }
 EOF
 
+cat > spirv.cpp <<'EOF'
+#include <glslang/SPIRV/GlslangToSpv.h>
+
+int main (void)
+{
+  std::string s;
+  glslang::GetSpirvVersion(s);
+  return 0;
+}
+EOF
+
 # This is hard-coded because there used to be no pkg-config, but matches
 # what renderdoc does.
 "${CXX}" -std=c++11 -o trivial trivial.cpp -lglslang -lMachineIndependent -lGenericCodeGen -lHLSL -lOGLCompiler -lOSDependent -lSPIRV -lpthread
@@ -48,5 +59,10 @@ test -x trivial
 test -x trivial
 ./trivial
 
+# shellcheck disable=SC2046
+"${CXX}" -std=c++11 -o spirv spirv.cpp $("$PKG_CONFIG" --cflags --libs spirv)
+test -x spirv
+./spirv
+
 cd /
 rm -fr "$tempdir"
-- 
2.30.1


Reply to: