diff options
| author | David Seifert <soap@gentoo.org> | 2025-05-19 12:11:34 +0200 |
|---|---|---|
| committer | Eli Schwartz <eschwartz93@gmail.com> | 2025-05-21 10:48:58 -0400 |
| commit | 835ca65c76ed6cd82e393f106b8196d4045ca512 (patch) | |
| tree | 56acafa788a62c31b64404ed9ec5bd6f1e23f92c | |
| parent | 3a935e586accac93e3ab66f0a38193efa804622e (diff) | |
| download | meson-835ca65c76ed6cd82e393f106b8196d4045ca512.tar.gz | |
cuda: look for stubbed libraries too
Some libraries in CUDA are stubbed out to load the actual implementation from
the driver at runtime. One example is NVML, that only exists in `stubs/`.
Ensure that the stubs dir is searched last, like FindCUDAToolkit.cmake:
https://github.com/Kitware/CMake/blob/4f2482700b6a6231c697b1178239acf76955bfeb/Modules/FindCUDAToolkit.cmake#L1163-L1173
| -rw-r--r-- | mesonbuild/dependencies/cuda.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/cuda.py b/mesonbuild/dependencies/cuda.py index 5a6d5b23b..4c36572f6 100644 --- a/mesonbuild/dependencies/cuda.py +++ b/mesonbuild/dependencies/cuda.py @@ -240,7 +240,14 @@ class CudaDependency(SystemDependency): all_found = True for module in self.requested_modules: - args = self.clib_compiler.find_library(module, self.env, [self.libdir], self.libtype, ignore_system_dirs=True) + # You should only ever link to libraries inside the cuda tree, nothing outside of it. + # For instance, there is a + # + # - libnvidia-ml.so in stubs/ of the CUDA tree + # - libnvidia-ml.so in /usr/lib/ that is provided by the nvidia drivers + # + # Users should never link to the latter, since its ABI may change. + args = self.clib_compiler.find_library(module, self.env, [self.libdir, os.path.join(self.libdir, 'stubs')], self.libtype, ignore_system_dirs=True) if args is None: self._report_dependency_error(f'Couldn\'t find requested CUDA module \'{module}\'') |
