cuda-samples compile but fail to link

Hi there,

when trying to build cuda-samples, I get this:

/usr/bin/nvcc -ccbin g++-5   -m64      -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_70,code=compute_70 -o conjugateGradientMultiBlockCG conjugateGradientMultiBlockCG.o  -lcudadevrt
nvlink error   : Undefined reference to 'cudaCGGetIntrinsicHandle' in 'conjugateGradientMultiBlockCG.o' (target: sm_60)
nvlink error   : Undefined reference to 'cudaCGSynchronize' in 'conjugateGradientMultiBlockCG.o' (target: sm_60)
Makefile:313: recipe for target 'conjugateGradientMultiBlockCG' failed

So what is wrong with my CUDA toolkit installation?

Here is what I did (on Ubuntu 18.04 x86_64):

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-driver nvidia-cuda-toolkit g++-5
git clone && cd cuda-samples

(The default gcc on this distribution is version 7, which does not work with CUDA. The ppa/deb-based installation of CUDA toolkit uses the standard prefix instead of /usr/local/cuda.)

Versions are:

  • CUDA toolkit 9.1.85
  • driver 390.67

ok, adding

EXTRA_NVCCFLAGS="-L /usr/lib/x86_64-linux-gnu"

helps, as suggested by

I wish the documentation (installation guide) were fixed like so:

  1. mention g++ versions above 5 do not work in dependencies
  2. mention how to cope with standard prefix in deb based install

Anyway, solved!