CUDA Mex files on a Mac with Snow Leopard


I have a problem compiling CUDA Mex files on a Mac with Snow Leopard. -

When calling the function I get the following error:

“(…) Library not loaded: @rpath/libcudart.dylib (…)”

I found this post here, where the problem seems to be similar. Unfortunately, his solution did not solve my problem.

I am using the same command lines:

system(sprintf('/usr/local/cuda/bin/nvcc --machine 32 -I"%s/extern/include" --cuda "" --output-file "my_cuda_mex.cpp"', matlabroot));

mex -I/usr/local/cuda/include -L/usr/local/cuda/lib -lcudart -lcufft my_cuda_mex.cpp

and I also added the " -Xlinker -rpath /usr/local/cuda/lib " at the end of LDFLAGS in the maci section of the file.

What else can I do?

I am using a MacBook Pro with a CUDA 3.0 installation and MATLAB R2009a (32bit).

Thank you in anticipation!