0
votes

Ive tried to compile a cuda program using nvcc but with the sudo command. First, it couldnt find the nvcc compiler, so I did as suggested here and created a symlink to nvcc in one of the directories listed in secure_path, like this: sudo ln -s /path/to/nvcc /sbin/nvcc.

But now Im trying to compile and keep getting the following error: nvcc fatal: Path to libdevice library not specified.

I guess that it has to do with the LD_LIBRARY_PATH variable that isnt set properly in root mode, but I cant find the way to solve it. Any ideas?

1
LD_LIBRARY_PATH has nothing to do with compiling. It is a runtime instruction to the operating system to identify where to look to load shared libraries, when an application is launched. - Robert Crovella

1 Answers

2
votes

Try not only to provide full path to nvcc, as you did, but also to the rest of dependencies, such as libraries, i.e.:

--dont-use-profile -ldir <path to your cuda_sdk/nvvm/libdevice/ > -I<path to your cuda_sdk/include/ dir> -L<path to your cuda_sdk/lib64/ dir>

Solution is based on this discussion, for explanation of nvcc command line parameters see documentation