Bug#995122: cuda.h shim

Raul Tambre raul at tambre.ee
Mon Sep 27 19:33:43 BST 2021


Simply symlinking doesn't actually quite work as evidenced by my CMake CI bot 
(<https://open.cdash.org/test/498767666>), where I applied it manually.

Having a shim /usr/lib/cuda/include/cuda.h:

     #pragma push_macro("CUDA_VERSION")
     #define CUDA_VERSION 11030
     #pragma pop_macro("CUDA_VERSION")
     #include_next <cuda.h>

Solves the issue. This was suggested in the LLVM discussion 
(<https://reviews.llvm.org/D108247#3025238>).

It is unclear to me why the symlink variant didn't work as previously when Clang 
detected the version using version.h having the cuda.h simply in /usr/include 
and thus the default search path was fine.
Though Clang is noted to be sensitive to the ordering of CUDA and other includes 
due to it wrapping/shimming them to make them work with Clang.



More information about the pkg-nvidia-devel mailing list