nvcc compiler setup Ubuntu 12.04

Solution 1:

It looks like you installed nvcc but it's not in the executable path.

The libraries are located in /usr/local/cuda-5.0/lib and /usr/local/cuda-5.0/lib64, so the executables are probably located in /usr/local/cuda-5.0/bin. Check in that directory, to see if there is a file called nvcc. If so, add /usr/local/cuda-5.0/bin to your PATH environment variable.

If nvcc is not located there, search the entire /usr/local/cuda-5.0 directory. One way to do that is to run the command:

find /usr/local/cuda-5.0 -name nvcc

Once you find it, you can add the directory that contains it to your PATH variable, or you can make a symbolic link to it in a directory that's in your PATH, or you can invoke it by its full path name (e.g., /usr/local/cuda-5.0/someplace/nvcc).

Solution 2:

In my build (Ubuntu Server 13.10), nvcc ended up in /usr/lib/nvidia-cuda-toolkit (in the 'bin' directory) - adding a symlink to there from /usr/local/cuda fixed up all of my CUDA problems.

sudo ln -s /usr/lib/nvidia-cuda-toolkit /usr/local/cuda

But YMMV.

Solution 3:

// , Follow the instructions outlined here:

http://www.r-tutor.com/gpu-computing/cuda-installation/cuda7.0-ubuntu

NVCC is part of the CUDA Toolkit.

I recommend installing the CUDA Toolkit directly from NVIDIA's site for such things:

https://developer.nvidia.com/cuda-downloads?sid=899051

Visit the above link, select the Linux x86 tab, and pick the .deb file for your distribution.

Like Eliah Kagan said, you'll find it in the default installation directory for the Toolkit files.

e.g., if you had CUDA 7.0 one would search in the /usr/local/cuda-7.0 directory:

find /usr/local/cuda-7.0 -name nvcc

The above command should generate output like /usr/local/cuda-7.0/bin/nvcc

If that doesn't work, try a more general search, like

find /usr/local -name nvcc

...or check where that version installed itself.

If one installs a different version, obviously the directory where it flings its files will vary accordingly.

Also, make sure that the shell gets nvcc and other runnables in its executable path by adding the following in the .bashrc file of your home folder.

export CUDA_HOME=/usr/local/cuda-7.0 
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 

PATH=${CUDA_HOME}/bin:${PATH} 
export PATH 

The above will allow you to run make for CUDA projects without errors about the meaninglessness of nvcc.