Bug#995122: cuda.h shim

Artem Belevich tra at google.com
Tue Sep 28 20:22:14 BST 2021


On Mon, 27 Sep 2021 21:33:43 +0300 Raul Tambre <raul at tambre.ee> wrote:
> It is unclear to me why the symlink variant didn't work as previously
when Clang

Clang (or rather the standardC++ library) relies on the standard C++
library headers to be present in the search path before the /usr/include
and such. CUDA wrappers and include files are added just before C++ library
headers, because we need that to make things like `#include <complex>`
work. Symlinking $CUDA/include -> /usr/include effectively places
/usr/include very early in the search path and makes it impossible to
intercept inclusions of headers that must be intercepted and that breaks
compilation.

I've just landed
https://reviews.llvm.org/rGfd582eeffe582665eacac522617a15e17e9872cd which
should move CUDA SDK includes down the search path, so making it a symlink
to /usr/include should no longer break compilation.

In general, I think a shim cuda.h header file is probably a safer approach
than symlinking $CUDA/include to /usr/include.
While it should be benign now, it does have potential to break things again
if/when compiler needs to rearrange it's include search order.
A shim cuda.h dues the bare minimum needed and will not be affected by
compiler changes, nor will it break compiler's assumptions about include
order.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-nvidia-devel/attachments/20210928/afca20fb/attachment.htm>


More information about the pkg-nvidia-devel mailing list