Linking against CUDA::cuda_driver not working right with libcuda stub, wants libcuda.so.1 not libcuda.so

eugenewalker
Mon, 13 Feb 2023 16:45:36 +0000
Code

We build our project cusz using CMake so that it links against CUDA::cuda_driver. For CI we build inside a Docker container where we have to rely on linking against the libcuda.so stub in the absence of the actual CUDA driver. This works fine for building cusz. However, when we ldd the resulting cusz library we see it expects libcuda.so.1 and not libcuda.so. This becomes a problem when we subsequently try to link a dependent package against cusz, also in a Docker container where we only have the stub, as the cusz library is not happy with the stub libcuda.so. It wants libcuda.so.1, which it cannot find, because the stubs only include .so named libraries.

I’m a bit confused because on the one hand, I can inspect the CMakeCache.txt from the successful build of cusz and see it finds the stub libcuda.so:

$> cat CMakeCache.txt
...
//Path to a library.
CUDA_cuda_driver_LIBRARY:FILEPATH=/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-11.1.0/cuda-11.8.0-bmwmhhbfgn7c3zokorcdz2pvv5qam3x2/lib64/stubs/libcuda.so
...

But then when we try to link against the resulting cusz library, it wants libcuda.so.1 which it can’t have in the Docker container environment where only the stub is available.

Does anyone know what is going on here?

13 posts - 6 participants