Package: src:nvidia-toolkit-samples
Version: 12.3~dfsg-1
Severity: serious
Tags: sid trixie
seen with autopkg tests triggered by gcc-12:
https://ci.debian.net/packages/n/nvidia-cuda-samples/testing/amd64/60466757/
2003s compile-cuda-samples_cuda-g++ FAIL non-zero exit status 2
2003s compile-cuda-samples_g++-12 FAIL non-zero exit status 2
tests linking against -lfreeimage fail to link with
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libfreeimage.so: undefined
reference to `std::ios_base_library_init()@GLIBCXX_3.4.32'
/usr/bin/ld: /lib/x86_64-linux-gnu/libIlmThread-3_1.so.30: undefined
reference to `__cxa_call_terminate@CXXABI_1.3.15'
At least for the g++-12 specific test, this is because the libstdc++.so
name in the internal gcc libdir
$ ls -l /usr/lib/gcc/x86_64-linux-gnu/12/libstdc++.*
-rw-r--r-- 1 root root 6026280 3. Mai 21:10
/usr/lib/gcc/x86_64-linux-gnu/12/libstdc++.a
-rw-r--r-- 1 root root 2194624 3. Mai 21:10
/usr/lib/gcc/x86_64-linux-gnu/12/libstdc++.so
is now a copy of the original gcc-12 libstdc++.so.6, which obviously
doesn't have symbols provided by the system-wide libstdc++.so, built
from the newest GCC version available. This is intended to prevent a
possible silent wrong-code issue when building packages with a legacy
g++ version (link with the 12 version, run with the default version).
The work around is to link these samples with --allow-shlib-undefined.
These are
$ fgrep -rl lfreeimage
Samples/4_CUDA_Libraries/boxFilterNPP/Makefile
Samples/4_CUDA_Libraries/cannyEdgeDetectorNPP/Makefile
Samples/4_CUDA_Libraries/freeImageInteropNPP/Makefile
Samples/4_CUDA_Libraries/histEqualizationNPP/Makefile
Samples/4_CUDA_Libraries/FilterBorderControlNPP/Makefile
The fix seems to be to add that flag to ALL_LDFLAGS
ALL_LDFLAGS += -Xlinker --allow-shlib-undefined
or add it to EXTRA_LDFLAGS before
EXTRA_LDFLAGS += --allow-shlib-undefined
however I don't see any use of EXTRA_LDFLAGS in these samples.
It looks like compile-cuda-samples_g++-12 and compile-cuda-samples_g++
run the same tests, both with g++-12, so failing both for the very same
reason.