mex file using CUDA compile issue /usr/bin/ld: skipping incompatible /usr/local/cuda/lib/

The error message is:

/usr/bin/ld: skipping incompatible /usr/local/cuda/lib/ when searching for -lcufft

/usr/bin/ld: cannot find -lcufft

collect2: ld returned 1 exit status

I don’t think my -lcufft parameter in compiling a .cu file is pointing to the correct library location. I believe its pointing to the 32bit version of the libraries while trying to compile for a 64-bit machine. I’m attempting to do this on an Ubuntu 9.10 64-bit system with gcc 4.4.1.

The 64bit libraries are now in /usr/local/cuda/lib64.
Change the -L flag to point to the right directory.

Thanks for the help. Also I had to add ‘-lcudart’ to fix some undefined references.

“INCLUDELIB = -L$(CUDAHOME)/lib64 -lcufft -lcudart -Wl,-rpath,$(CUDAHOME)/lib”

is now in my Makefile.

But after fixing that issue, I have another error. Is mexversion.c deprecated?

./nvmex -f directory/Matlab_Cuda_1.1/ -I/usr/local/cuda/include -L/usr/local/cuda/lib64 -lcufft -lcudart -Wl,-rpath,/usr/local/cuda/lib

	mex:  /matlab2009b_directory/extern/src/mexversion.c not a normal file or does not exist.

make: *** [Szeta.mexa64] Error 1

Try this other method.

From inside Matlab:

!nvcc -c -Xcompiler -fPIC -I /usr/local/matlab/extern/include

mex myfun.o -L /usr/local/cuda/lib64 -lcudart -lcufft