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

Bug#980369: glslang: autopkgtest regression: undefined reference to `ShConstructUniformMap'



Source: glslang
Version: 11.1.0-1
Severity: serious
Justification: release team policy
X-Debbugs-Cc: debian-ci@lists.debian.org
User: debian-ci@lists.debian.org
Usertags: regression
Tags: patch

Thanks for adding an autopkgtest (#940488) and pkg-config metadata
(#940487). However, since version 11.1.0-1, glslang fails the autopkgtest,
for example in
https://ci.debian.net/data/autopkgtest/testing/amd64/g/glslang/9766376/log.gz:

autopkgtest [13:18:41]: test glslang-dev: [-----------------------
+ mktemp -d
+ tempdir=/tmp/tmp.UEoTRS3LSr
+ cd /tmp/tmp.UEoTRS3LSr
+ cat
+ c++ -std=c++11 -o trivial trivial.cpp -lglslang -lHLSL -lOGLCompiler -lOSDependent -lSPIRV -lpthread
/usr/bin/ld: /tmp/ccZLSVyX.o: in function `main':
trivial.cpp:(.text+0x9): undefined reference to `ShConstructUniformMap'
/usr/bin/ld: trivial.cpp:(.text+0x19): undefined reference to `ShDestruct'
collect2: error: ld returned 1 exit status
autopkgtest [13:18:42]: test glslang-dev: -----------------------]

This indicates that the compile-time interface has changed: it is now
necessary for client code to link to -lMachineIndependent and
-lGenericCodeGen in addition to the libraries that were previously
required. This will presumably mean that some packages dependent on
glslang will now FTBFS.

Linking with the new glslang.pc seems to have the same bug: glslang.pc
needs updating for the new compile-time interface.

I attach an attempt to fix this, together with improvements to the
autopkgtest.

(I should warn you that I don't really know how this library works,
so I'm guessing at what the intended compile-time interface is; please
review accordingly.)

    smcv
>From fa64521cbd0bab95e1b5b4d935988e9e3c6be494 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 18 Jan 2021 10:41:45 +0000
Subject: [PATCH 1/5] d/tests: Recode into UTF-8

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 debian/tests/glslang-dev   | 2 +-
 debian/tests/glslang-tools | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/tests/glslang-dev b/debian/tests/glslang-dev
index 84463a9b..9cb42d7e 100755
--- a/debian/tests/glslang-dev
+++ b/debian/tests/glslang-dev
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright � 2019 Collabora Ltd.
+# Copyright © 2019 Collabora Ltd.
 # SPDX-License-Identifier: MIT
 # (see debian/copyright)
 
diff --git a/debian/tests/glslang-tools b/debian/tests/glslang-tools
index 1511c07a..2445c3ca 100755
--- a/debian/tests/glslang-tools
+++ b/debian/tests/glslang-tools
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright � 2019 Collabora Ltd.
+# Copyright © 2019 Collabora Ltd.
 # SPDX-License-Identifier: MIT
 # (see debian/copyright)
 
-- 
2.30.0

>From cd19f2103a94377a7acefb57420f212c5280457a Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 18 Jan 2021 09:32:34 +0000
Subject: [PATCH 2/5] d/tests/glslang-dev: Use proposed interface for
 cross-testing

This allows testing glslang-dev:i386 on an amd64 system (see
<https://salsa.debian.org/ci-team/autopkgtest/-/merge_requests/69>).

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 debian/tests/glslang-dev | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/debian/tests/glslang-dev b/debian/tests/glslang-dev
index 9cb42d7e..6bf09482 100755
--- a/debian/tests/glslang-dev
+++ b/debian/tests/glslang-dev
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright © 2019 Collabora Ltd.
+# Copyright © 2019-2021 Collabora Ltd.
 # SPDX-License-Identifier: MIT
 # (see debian/copyright)
 
@@ -9,6 +9,14 @@ set -e
 set -u
 set -x
 
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+    CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+    CROSS_COMPILE=
+fi
+CXX="${CROSS_COMPILE}g++"
+PKG_CONFIG="${CROSS_COMPILE}pkg-config"
+
 tempdir="$(mktemp -d)"
 cd "$tempdir"
 
@@ -27,9 +35,9 @@ int main (void)
 }
 EOF
 
-# This is hard-coded because there's no pkg-config, but that matches
-# what renderdoc does...
-c++ -std=c++11 -o trivial trivial.cpp -lglslang -lHLSL -lOGLCompiler -lOSDependent -lSPIRV -lpthread
+# 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 -lHLSL -lOGLCompiler -lOSDependent -lSPIRV -lpthread
 test -x trivial
 ./trivial
 
-- 
2.30.0

>From 65ca014d535af865479a64577f8b092fa60310d6 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 18 Jan 2021 09:41:58 +0000
Subject: [PATCH 3/5] d/tests/glslang-dev: Add missing libraries to linker line

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 debian/tests/glslang-dev | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/tests/glslang-dev b/debian/tests/glslang-dev
index 6bf09482..1804c26a 100755
--- a/debian/tests/glslang-dev
+++ b/debian/tests/glslang-dev
@@ -37,7 +37,7 @@ 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 -lHLSL -lOGLCompiler -lOSDependent -lSPIRV -lpthread
+"${CXX}" -std=c++11 -o trivial trivial.cpp -lglslang -lMachineIndependent -lGenericCodeGen -lHLSL -lOGLCompiler -lOSDependent -lSPIRV -lpthread
 test -x trivial
 ./trivial
 
-- 
2.30.0

>From c49cfcb5e949a4fd6fa31d0fa0bb8fca5d1d8ee0 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 18 Jan 2021 10:23:53 +0000
Subject: [PATCH 4/5] Add missing -lMachineIndependent and -lGenericCodeGen to
 pkg-config file

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 .../glslang.pc-Add-missing-libraries.patch    | 25 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 debian/patches/glslang.pc-Add-missing-libraries.patch

diff --git a/debian/patches/glslang.pc-Add-missing-libraries.patch b/debian/patches/glslang.pc-Add-missing-libraries.patch
new file mode 100644
index 00000000..9fd25c83
--- /dev/null
+++ b/debian/patches/glslang.pc-Add-missing-libraries.patch
@@ -0,0 +1,25 @@
+From: Simon McVittie <smcv@collabora.com>
+Date: Mon, 18 Jan 2021 09:57:55 +0000
+Subject: glslang.pc: Add missing libraries
+
+-lglslang depends on -lMachineIndependent, and -lOGLCompiler depends on
+-lGenericCodeGen.
+
+Signed-off-by: Simon McVittie <smcv@collabora.com>
+---
+ glslang/glslang.pc.cmake.in | 4 ++--
+ 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
+--- a/glslang/glslang.pc.cmake.in
++++ b/glslang/glslang.pc.cmake.in
+@@ -7,5 +7,5 @@
+     Description: OpenGL and OpenGL ES shader front end and validator
+     Requires:
+     Version: @VERSION@
+-    Libs: -L${libdir} -lglslang -lOSDependent -lHLSL -lOGLCompiler -lSPVRemapper
+-    Cflags: -I${includedir}
+\ No newline at end of file
++    Libs: -L${libdir} -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen -lSPVRemapper
++    Cflags: -I${includedir}
diff --git a/debian/patches/series b/debian/patches/series
index 1779d53c..7d0b1f9a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 glslang-default-resource-limits_staticlib.patch
 0001-pkg-config-compatibility.patch
+glslang.pc-Add-missing-libraries.patch
-- 
2.30.0

>From 0e266741f9a2d14828b647ca7be3b040cdd7f6cb Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 18 Jan 2021 09:34:43 +0000
Subject: [PATCH 5/5] d/tests/glslang-dev: Check that glslang.pc is sufficient

Reproduces: #951988
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 debian/tests/glslang-dev | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/debian/tests/glslang-dev b/debian/tests/glslang-dev
index 1804c26a..6a45a048 100755
--- a/debian/tests/glslang-dev
+++ b/debian/tests/glslang-dev
@@ -41,5 +41,12 @@ EOF
 test -x trivial
 ./trivial
 
+# Or with the pkg-config metadata.
+# Deliberately word-splitting the output of pkg-config:
+# shellcheck disable=SC2046
+"${CXX}" -std=c++11 -o trivial trivial.cpp $("$PKG_CONFIG" --cflags --libs glslang)
+test -x trivial
+./trivial
+
 cd /
 rm -fr "$tempdir"
-- 
2.30.0


Reply to: