| Issue |
244941
|
| Summary |
[Clang][CUDA] `__clang_cuda_runtime_wrapper.h` unconditionally includes `curand_mtgp32_kernel.h`, failing every CUDA compilation when libcurand-dev is not installed
|
| Labels |
clang
|
| Assignees |
|
| Reporter |
namnkahn1607
|
`clang/lib/Headers/__clang_cuda_runtime_wrapper.h` contains an unconditional `#include "curand_mtgp32_kernel.h"` at line 505. This causes CUDA installation without cuRAND to fail on **every** attempts to compile a CUDA TU, including `__global__ void k() {}`, while `nvcc` compiles the same file without any complaints.
## Reproducing
```
$ cat t.cu
__global__ void k() {}
int main() { k<<<1,1>>>(); }
$ nvcc -arch=sm_86 -c t.cu -o /tmp/t.o && echo nvcc OK
nvcc OK
$ clang++ -x cuda --cuda-path=/usr/local/cuda-12.8 --cuda-gpu-arch=sm_86 -fsyntax-only t.cu
In file included from <built-in>:1:
.../__clang_cuda_runtime_wrapper.h:505:10: fatal error: 'curand_mtgp32_kernel.h' file not found
505 | #include "curand_mtgp32_kernel.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated when compiling for sm_86.
```
Installing `libcurand-dev-12-8` makes the same command succeed.
## Environment
- OS: Ubuntu 24.04.4 LTS
- `Ubuntu clang version 22.1.8 (++20260714014902+ca7933e47d3a-1~exp1~20260714135019.80)`
- `Ubuntu clang version 24.0.0 (++20261117082151+fb93c76fd8aa-1~exp1~20261117082352.1938)`
- CUDA 12.8 from NVIDIA's apt repository:
- `cuda-nvcc-12-8` and `cuda-cudart-dev-12-8`, without `libcurand-dev-12-8` (10.3.9.90-1).
- The `clang::driver::CudaInstallationDetector` driver accepted the installation.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs