Cuda 9.2 Samples 'make' failure - cannot compile example code

You’re running make in a directory structure where you don’t have write access permissions.

To work around this you could do

sudo make

or even better

sudo make -k

alternatively, when installing CUDA, use the runfile installer and have it install the sample codes to a directory structure where you have write access permissions.

Doing

sudo chmod 777 NVIDIA_CUDA-9.2_Samples.

does not fix this issue. It only fixes it for that one particular directory, but the make process will move around in various directories.