user1388297
user1388297

Reputation: 11

pycuda installation error on ubuntu: /usr/bin/ld: cannot find -lcuda

I am beginner and installing pycuda2011.2.2 on ubuntu 11.10, but can't complete it. Cuda is 4.0.

I have installed libraries:

$ sudo apt-get install build-essential python-dev python-setuptools libboost-python-dev libboost-thread-dev -y

calling configure.py like this:

$ ./configure.py --cuda-root=/usr/local/cuda --cudadrv-lib-dir=/usr/lib --boost-inc-dir=/usr/include --boost-lib-dir=/usr/lib --boost-python-libname=boost_python-mt-py27 --boost-thread-libname=boost_thread-mt

But, When i do:

.....@ubuntu:~/pycuda-2011.2.2$ make -j 4 

I get this error:

/usr/bin/ld: cannot find -lcuda

/usr/bin/ld: skipping incompatible /usr/local/cuda/lib/libcurand.so when searching for -lcurand

why this error ?

Thanks.

Upvotes: 1

Views: 2416

Answers (2)

François Landes
François Landes

Reputation: 758

If you use some newer drivers for the nvidia card, like nvidia-313 (that's what I use), then the file libcuda.so (which is nicknamed lcuda, I don't know why) may not be in the cuda installation directory (which, by default, is /usr/lib/cuda). Instead, you might have to find it by yourself. Do:

$ find /usr/lib/*/libcuda.so

for me, the result is

/usr/lib/nvidia-313-updates/libcuda.so

so, when installing pycuda, I do:

$ python configure.py --cuda-root=/usr/lib/nvidia-313-updates

$ make

$ sudo make install

then,

$ optirun python test/test_driver.py

or

$ optirun python some_program_which_imports_pycuda.py

should work fine.

Upvotes: 0

kynan
kynan

Reputation: 13613

You need to set the LDFLAGS environment variable so that the pycuda setup can find libcuda.so, which on ubuntu systems is in a non-standard location (/usr/lib/nvidia-current).

The installation of pycuda 2012.1 is entirely distutils based, no Makefile involved. You install pycuda by running ./configure.py with the appropriate options followed by LDFLAGS=/usr/lib/nvidia-current python setup.py install.

Upvotes: 1

Related Questions