Question

I'm trying to build a project in nsight using the cufft.so library, but the linker (ld) can't find the library file, and I'm stumped.

The library is installed as /usr/local/cuda/lib64/libcufft.so

In the project properties I have gone to "General->Paths and Symbols->Libraries" tab and added /usr/local/cuda/lib64/libcufft.so, and for good measure went to the Libraries Paths tab and added /usr/local/cuda/lib64

The exact error is

Finished building: ../main.cu

Building target: cufftTest2
Invoking: NVCC Linker
/usr/local/cuda-5.5/bin/nvcc --cudart static -L/usr/local/cuda/lib64 -link -o  "cufftTest2"  ./main.o   -l/usr/local/cuda/lib64/libcufft.so
/usr/bin/ld: cannot find -l/usr/local/cuda/lib64/libcufft.so
collect2: error: ld returned 1 exit status
make: *** [cufftTest2] Error 1

and the environment paths are configured as:

echo $LD_LIBRARY_PATH
/usr/local/cuda/lib64:
echo $PATH
/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
echo $MANPATH
/usr/local/cuda/man:

I'm sure I've done something dumb, but I have no idea why ld can't find /usr/local/cuda/lib64/libcufft.so

Can anyone help with this?

Was it helpful?

Solution

Just use cufft as the library, so that it shows up as -lcufft in the actual linker command line.

The gcc linker used by nvcc for host code compilation and linking expects the libraries to be indicated like this:

Library:

/path/to/library/libmystuff.so

Linker switches:

-L/path/to/library/
-lmystuff

(notice that the lib prefix and .so suffix are dropped)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top