Cannot find -lcuda?

I’m new to programming under Linux
I have a lot of trouble trying to compile the SDK sample programs under Ubuntu 10.04. I downgraded GCC to 4.3 and added : NVCCFLAGS += --compiler-bindir=/usr/bin/gcc-4.3 to the file… well, it seems to work better than 4.4!
But the make still doesn’t work. It returns ‘Cannot find -lcuda’. I searched for and found it in /usr/lib64/nvidia-current/

Some points :

  • CUDA SDK was installed as a regular user
  • make is run as a regular user
  • echo $PATH returns : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/cuda/bin
  • echo $LD_LIBRARY_PATH returns : /usr/local/cuda/lib64:/usr/lib64/nvidia-current

I don’t understand what is wrong…

Thanks for helping a newbie! :">

When I upgraded to ubuntu 10.04, I found that the nvidia-current drivers were not really suitable for cuda development.
After installing the binary drivers from nvidia’s download page, everything ran smoothly.

Maybe this post can help you out.


I agree; the “automagic” driver in 10.04 does not play well with CUDA. Installing the driver direct from nVidia sorted the problem out for me.

Thanks for your answers but I am using the drivers from Nvidia website directly.

One more things I’ve just noticed : it works fine up to ptxjit… (i can run deviceQuery, oceanFFT, fluidsGL…)
So i tried with a simple Hello Cuda World!… This time it said me that it couldn’t find ‘-lcutil_x86_64’ even if i add the SDK path into LD_LIBRARY_PATH and even if i modify the file nvcc.profile!

There’s a misconception as to what LD_LIBRARY_PATH does: it only affects where the loader looks at runtime. However, it does not influence where the compiler is looking for libraries at compile time.

Problem: In current releases of the nvidia driver libcuda is located in /usr/lib/nvidia-current, which is the cause of this error.
Solution: Add -L/usr/lib/nvidia-current to your compiler flags.

There’s no need to manually install the nvidia drivers, recent ubuntu packaged drivers are fine.

System: Tesla M2050, Ubuntu 11.10, Cuda Toolkit, Cuda Tools, Visual Profiler, etc.

  1. I have the same error (cannot locate lcuda) and my in the /NVIDIA_GPU_Computing_SDK is pasted below. How do I add the compiler flags as you mentioned?

  2. The deviceQuery program is missing. is there but no .

  3. the lspci | grep -i nvidia command replies that I am running the Tesla S2050 not the M2050.

  4. Do I need to use the NVIDIA 290.10 for Tesla M2050 to work with Cuda Tools?

GPU Computing SDK Version 4.0.8

@(MAKE) -C ./shared @(MAKE) -C ./C
@(MAKE) -C ./CUDALibraries @(MAKE) -C ./OpenCL

@(MAKE) -C ./shared clean @(MAKE) -C ./C clean
@(MAKE) -C ./CUDALibraries clean @(MAKE) -C ./OpenCL clean

@(MAKE) -C ./shared clobber @(MAKE) -C ./C clobber
@(MAKE) -C ./CUDALibraries clobber @(MAKE) -C ./OpenCL clobber

If you’ll look down about 8 or 10 threads, you’ll find one with the same title that goes into the issue in some detail. Basically, the SDK installs in /usr/local/cuda/lib{64}, while the driver installs in some other place. So if you want to compile & link code on a machine that doesn’t have an NVidia card installed (as is the case with my laptop), you can link with -lcudart and produce an executable.

Here’s a link:

Thank you! I will try this.