ld cannot find -lcuda, when compiling cuda programs

Bug #587288 reported by Matti Laakso on 2010-05-29
This bug affects 7 people
Affects Status Importance Assigned to Milestone
nvidia-graphics-drivers (Ubuntu)

Bug Description

When trying to compile NVidia GPU computing SDK samples with CUDA toolkit 3.0, the build process stops with

make[1]: Entering directory `/home/matti/NVIDIA_GPU_Computing_SDK/C/src/threadMigration'
/usr/bin/ld: cannot find -lcuda
collect2: ld returned 1 exit status
make[1]: *** [../../bin/linux/release/threadMigration] Error 1
make[1]: Leaving directory `/home/matti/NVIDIA_GPU_Computing_SDK/C/src/threadMigration'
make: *** [src/threadMigration/Makefile.ph_build] Error 2

However, libcuda.so can be found under /usr/lib/nvidia-current. I'm using the 256.25 drivers from the X updates PPA, but according to reports on other forums, also the official nvidia-current package exhibits the same issue. Also, the official drivers downloaded from nvidia.com do not exhibit this issue.

David Tomaschik (matir) wrote :

You probably need to build it with -L/usr/lib/nvidia-current to tell ld to search that path. This can generally be done in the Makefile for the application you are building.

Changed in nvidia-graphics-drivers (Ubuntu):
status: New → Incomplete
Matti Laakso (matti-laakso) wrote :

That helped, thanks. I had always thought that also ld searches the paths set in ld.so.conf, but it seems not to be the case.

Anyway, could the update-alternatives system be used somehow to circumvent the "nonstandard" location of the driver by creating symlinks to /usr/lib?

Changed in nvidia-graphics-drivers (Ubuntu):
status: Incomplete → Invalid
Changed in nvidia-graphics-drivers (Ubuntu):
status: Invalid → Incomplete
Bryce Harrington (bryce) wrote :

We're closing this bug since it is has been some time with no response from the original reporter. However, if the issue still exists please feel free to reopen with the requested information. Also, if you could, please test against the latest development version of Ubuntu, since this confirms the bug is one we may be able to pass upstream for help.

Changed in nvidia-graphics-drivers (Ubuntu):
status: Incomplete → Expired

I confirm the bug with ubuntu 10.10 : drivers from nvidia works but not the packaged drivers.
It seems that there is a problem with symbolic link and/or variables environment.

Please reopen this bug

Changed in nvidia-graphics-drivers (Ubuntu):
status: Expired → Confirmed
Karl Ljungkvist (k-ljungkvist) wrote :

I confirm this in natty. Why are the drivers not installed in the usual place?

IRIE Shinsuke (irie) wrote :

This problem can be solved by putting .profile file the following line:

export LIBRARY_PATH="/usr/lib/nvidia-current"

I think creating /etc/profile.d/nvidia-current.sh file containing the above is good idea. This file provides the system-wide setting.

IRIE Shinsuke (irie) wrote :


export LIBRARY_PATH="/usr/lib/nvidia-current:$LIBRARY_PATH"

is better than my previous code in comment #6.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers