Source: shaderc
Version: 2024.4-1
Severity: normal
Tags: patch

The test in debian/tests/lib explicitly links the dummy binary to
libshaderc, but also to glslang and glslang's -lSPIRV:

> g++ -o $dummy_binary $dummy_source $(pkg-config --libs --cflags shaderc 
> glslang spirv)

The intended design of pkg-config is that you only need to list packages
on the pkg-config command-line if you are explicitly calling functions
from those packages in your own source code. If an API user is only
calling functions from libshaderc, with the other packages being an
implementation detail of libshaderc (which seems to be true here),
then the API user shouldn't need to know about those libraries because
shaderc.pc should encapsulate all dependencies, via either Requires,
Libs/Cflags, or static linking.

So this would be a more thorough test if it was written like this:

#########
--- a/debian/tests/lib
+++ b/debian/tests/lib
@@ -26,6 +26,6 @@ int main() {
 }
 EOF

-g++ -o $dummy_binary $dummy_source $(pkg-config --libs --cflags shaderc 
glslang spirv)
+g++ -o $dummy_binary $dummy_source $(pkg-config --libs --cflags shaderc)
 test -x $dummy_binary
 ./$dummy_binary
#########

and in particular that would probably have been enough to detect #1029939
without needing to write extra test code.

If the more thorough version of the autopkgtest starts failing, then that
would indicate that either shaderc.pc is incomplete and needs more Requires,
Libs or Cflags to be added, or the shared library is "underlinked" similar
to #1029939.

Thanks,
    smcv

Reply via email to