Building the SDK 4.1 /usr/bin/ld: cannot find -lcuda
Not getting anywhere w/ the linux people,...


I've got a new machine, and trying to build the code examples in the SDK. The build doesn't get very far.
It err's at the device query project.
The linker can't find a library, and I'm not sure why.
The paths are setup as described in the install doc's.



~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery$ echo [b]$PATH[/b]
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: [b]/usr/local/cuda/bin[/b]

~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release$ [b]ldconfig -v | grep cuda[/b]
[b]/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once
/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once[/b]
/usr/local/cuda/lib64:
libcudart.so.4 -> libcudart.so.4.1.28
/usr/local/cuda/lib:
libcudart.so.4 -> libcudart.so.4.1.28
[b]libcuda.so.1 -> libcuda.so.295.20
libcuda.so.1 -> libcuda.so.295.20[/b]
libicudata.so.44 -> libicudata.so.44.2

~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery$ [b]gcc --version[/b]
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) [b]4.5.2[/b]

~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery$ [b]cat /proc/driver/nvidia/version[/b]
NVRM version: NVIDIA UNIX x86_64 Kernel Module [b]295.20[/b] Mon Feb 6 21:07:30 PST 2012

~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery$ [b]uname -m && cat /etc/*release[/b]
x86_64
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=[b]11.04[/b]


~/NVIDIA_GPU_Computing_SDK/C/src/[b]deviceQuery[/b]$ make
[b]/usr/bin/ld: cannot find -lcuda[/b]
collect2: ld returned 1 exit status
make: *** [../../bin/linux/release/deviceQuery] Error 1

From the projects makefile:
(The line causing the problem.)
[b]LIB += -lcuda[/b]

I'm not sure where in the make environment that LIB is created.
I'm not sure where the libcuda.so files are located, but they are in the ldconfig. (see above)
I tried it with the LD_LIBRARY_PATH environment var as well and got the same err.

I can build and run the bandwidthTest project.

Any suggestion to fixing the build?
Thanks
Not getting anywhere w/ the linux people,...





I've got a new machine, and trying to build the code examples in the SDK. The build doesn't get very far.

It err's at the device query project.

The linker can't find a library, and I'm not sure why.

The paths are setup as described in the install doc's.







~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery$ echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: /usr/local/cuda/bin



~/NVIDIA_GPU_Computing_SDK/C/bin/linux/release$ ldconfig -v | grep cuda

/sbin/ldconfig.real: Path `/lib/x86_64-linux-gnu' given more than once

/sbin/ldconfig.real: Path `/usr/lib/x86_64-linux-gnu' given more than once


/usr/local/cuda/lib64:

libcudart.so.4 -> libcudart.so.4.1.28

/usr/local/cuda/lib:

libcudart.so.4 -> libcudart.so.4.1.28

libcuda.so.1 -> libcuda.so.295.20

libcuda.so.1 -> libcuda.so.295.20


libicudata.so.44 -> libicudata.so.44.2



~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery$ gcc --version

gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2



~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery$ cat /proc/driver/nvidia/version

NVRM version: NVIDIA UNIX x86_64 Kernel Module 295.20 Mon Feb 6 21:07:30 PST 2012



~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery$ uname -m && cat /etc/*release

x86_64

DISTRIB_ID=Ubuntu

DISTRIB_RELEASE=11.04





~/NVIDIA_GPU_Computing_SDK/C/src/deviceQuery$ make

/usr/bin/ld: cannot find -lcuda

collect2: ld returned 1 exit status

make: *** [../../bin/linux/release/deviceQuery] Error 1



From the projects makefile:

(The line causing the problem.)

LIB += -lcuda



I'm not sure where in the make environment that LIB is created.

I'm not sure where the libcuda.so files are located, but they are in the ldconfig. (see above)

I tried it with the LD_LIBRARY_PATH environment var as well and got the same err.



I can build and run the bandwidthTest project.



Any suggestion to fixing the build?

Thanks

#1
Posted 03/10/2012 12:32 AM   
libcuda is installed by the driver.

What is the output of "locate libcuda.so" ?
libcuda is installed by the driver.



What is the output of "locate libcuda.so" ?

#2
Posted 03/10/2012 01:43 AM   
[b]locate libcuda.so[/b]
/usr/lib/nvidia-current/libcuda.so
/usr/lib/nvidia-current/libcuda.so.1
/usr/lib/nvidia-current/libcuda.so.295.20
/usr/lib32/nvidia-current/libcuda.so
/usr/lib32/nvidia-current/libcuda.so.1
/usr/lib32/nvidia-current/libcuda.so.295.20

Both the libcuda.so and libcuda.so.1 are links to libcuda.so.295.20.

I reinstalled the latest driver, just for the heck of it. Still the same err.
sudo apt-get install --reinstall nvidia-current

My starting point for all this was a fresh install of 11.04.
Everything was installed to the default locations.

Thanks for the response.
locate libcuda.so

/usr/lib/nvidia-current/libcuda.so

/usr/lib/nvidia-current/libcuda.so.1

/usr/lib/nvidia-current/libcuda.so.295.20

/usr/lib32/nvidia-current/libcuda.so

/usr/lib32/nvidia-current/libcuda.so.1

/usr/lib32/nvidia-current/libcuda.so.295.20



Both the libcuda.so and libcuda.so.1 are links to libcuda.so.295.20.



I reinstalled the latest driver, just for the heck of it. Still the same err.

sudo apt-get install --reinstall nvidia-current



My starting point for all this was a fresh install of 11.04.

Everything was installed to the default locations.



Thanks for the response.

#3
Posted 03/10/2012 02:21 PM   
Hi, I met nearly the same problem and troubled me both when I want to compile the gpu SDK samples and pyCUDA. However I just solved it.

The brief profile of my computer and os is listed below:

OS : Fedora 16
GPU: GeForce GTX550Ti
DRV: yum installed the akmod-nvidia driver, and banned the nouveau driver came from Fedora
CUDAToolkit : Latest Verson

When I came to the procedure of compiling SDK samples, it would exit with error : "/usr/bin/ld: cannot find -lcuda", the same thing happend when
I just want to compile and install pyCUDA package. However I could find libcuda.so libcuda.so.1 in path /usr/lib64/nvidia/.

I searched out a webpage "http://reset.etsii.upm.es/en/users/peque/installing-cuda-in-fedora-16/ " and the last suggested that make symbolic links like:

ln -s /usr/lib64/nvidia/libcuda.so /usr/lib64/libcuda.so && ln -s /usr/lib64/nvidia/libcuda.so.1 /usr/lib64/libcuda.so.1

And this command solved my problem.
Hi, I met nearly the same problem and troubled me both when I want to compile the gpu SDK samples and pyCUDA. However I just solved it.



The brief profile of my computer and os is listed below:



OS : Fedora 16

GPU: GeForce GTX550Ti

DRV: yum installed the akmod-nvidia driver, and banned the nouveau driver came from Fedora

CUDAToolkit : Latest Verson



When I came to the procedure of compiling SDK samples, it would exit with error : "/usr/bin/ld: cannot find -lcuda", the same thing happend when

I just want to compile and install pyCUDA package. However I could find libcuda.so libcuda.so.1 in path /usr/lib64/nvidia/.



I searched out a webpage "http://reset.etsii.upm.es/en/users/peque/installing-cuda-in-fedora-16/ " and the last suggested that make symbolic links like:



ln -s /usr/lib64/nvidia/libcuda.so /usr/lib64/libcuda.so && ln -s /usr/lib64/nvidia/libcuda.so.1 /usr/lib64/libcuda.so.1



And this command solved my problem.

#4
Posted 04/04/2012 04:53 AM   
Thanks, that did it. (Looking for the library in a different location.)
The libraries are in the "nvidia-current" folder, but the linker is looking in the "lib" folder.

Make a symbolic link in the "lib" folder that points to the "nvidia-current" folder:
sudo ln -s /usr/lib/nvidia-current/libcuda.so /usr/lib/libcuda.so && ln -s /usr/lib/nvidia-current/libcuda.so.1 /usr/lib/libcuda/so.1
Thanks, that did it. (Looking for the library in a different location.)

The libraries are in the "nvidia-current" folder, but the linker is looking in the "lib" folder.



Make a symbolic link in the "lib" folder that points to the "nvidia-current" folder:

sudo ln -s /usr/lib/nvidia-current/libcuda.so /usr/lib/libcuda.so && ln -s /usr/lib/nvidia-current/libcuda.so.1 /usr/lib/libcuda/so.1

#5
Posted 04/09/2012 09:27 PM   
son of devil google. '/usr/bin/ld: cannot find lcuda' search gave me link to all 3 threads i made for pycuda installtion error. But, didn't brought me here. I have wandered a lot. This is a useful thread.
son of devil google. '/usr/bin/ld: cannot find lcuda' search gave me link to all 3 threads i made for pycuda installtion error. But, didn't brought me here. I have wandered a lot. This is a useful thread.

#6
Posted 05/25/2012 06:52 PM   
Arguably the safer option is adding [code]-L/usr/lib/nvidia-current[/code] to you linker flags. [url="http://stackoverflow.com/q/2716293#comment8885854_2716432"]In the case of the CUDA SDK[/url] change common.mk:148 to [code]LINKFLAGS += -L/usr/lib/nvidia-current[/code]
Arguably the safer option is adding
-L/usr/lib/nvidia-current
to you linker flags. In the case of the CUDA SDK change common.mk:148 to
LINKFLAGS += -L/usr/lib/nvidia-current

#7
Posted 06/27/2012 12:47 AM   
Scroll To Top