Library not loaded: @rpath/libcudart.dylib
Hello,

I know this has been on the forums before but I'm growing ever desperate. Im hoping one of you can help me with this problem. I have a .cu file that I can compile perfectly well thanks to the following suggestion by mfatica in this thread by laxxy: [url="http://forums.nvidia.com/index.php?showtopic=153697"]http://forums.nvidia.com/index.php?showtopic=153697[/url]. Typing

[code]nvcc -c knn.cu -Xcompiler -fPIC -I /Applications/MATLAB_R2009b.app/extern/include/[/code]
in the terminal and then

[code]mex knn.o -L/usr/local/cuda/lib/ -lcudart -lcufft -lcuda[/code]

in the matlab terminal compiles 'knn.mexmaci' successfully. However, running the app only returns "Library not loaded: @rpath/libcudart.dylib". These lines are returned by printenv (minus uninteresting stuff),

[code]LD_LIBRARY_PATH=/usr/local/cuda/cudaprof/bin:/usr/local/cuda/lib:/usr/lib:/usr/openwin/lib:/usr/dt/lib:/X11.6/lib:/X11.5/lib:/uva/lib:/gnu/lib:/usr/local/cuda/lib:/usr/local/cuda/lib
PATH=/usr/local/cuda/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin
DYLD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/lib:[/code]

As you can see, I've set the environment variables numerous times. So far, I've only come across posts where the problem is solved by setting the environment variables. Is there any other way to work around this?
Hello,



I know this has been on the forums before but I'm growing ever desperate. Im hoping one of you can help me with this problem. I have a .cu file that I can compile perfectly well thanks to the following suggestion by mfatica in this thread by laxxy: http://forums.nvidia.com/index.php?showtopic=153697. Typing



nvcc -c knn.cu -Xcompiler -fPIC -I /Applications/MATLAB_R2009b.app/extern/include/


in the terminal and then



mex knn.o -L/usr/local/cuda/lib/ -lcudart -lcufft -lcuda




in the matlab terminal compiles 'knn.mexmaci' successfully. However, running the app only returns "Library not loaded: @rpath/libcudart.dylib". These lines are returned by printenv (minus uninteresting stuff),



LD_LIBRARY_PATH=/usr/local/cuda/cudaprof/bin:/usr/local/cuda/lib:/usr/lib:/usr/openwin/lib:/usr/dt/lib:/X11.6/lib:/X11.5/lib:/uva/lib:/gnu/lib:/usr/local/cuda/lib:/usr/local/cuda/lib

PATH=/usr/local/cuda/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin

DYLD_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/cuda/lib:




As you can see, I've set the environment variables numerous times. So far, I've only come across posts where the problem is solved by setting the environment variables. Is there any other way to work around this?

#1
Posted 01/18/2010 05:25 PM   
It looks like you have not downloaded and installed the "CUDA Toolkit". The driver download does not install that library.

do this: ls /usr/local/cuda/lib

See if libcudart.dylib is actually there.
It looks like you have not downloaded and installed the "CUDA Toolkit". The driver download does not install that library.



do this: ls /usr/local/cuda/lib



See if libcudart.dylib is actually there.

#2
Posted 01/19/2010 02:56 AM   
Ok thanks, just did. I'm afraid it is there. What bothers me is that it wont run even though I can compile. For instance, compiling without -lcudart yields all the undefined symbol errors I would expect so the compiler correctly identifies libcudart.

Any chance of clarifying this?

Edit: Btw deviceQuery and bandwithTest pass successfully.
Ok thanks, just did. I'm afraid it is there. What bothers me is that it wont run even though I can compile. For instance, compiling without -lcudart yields all the undefined symbol errors I would expect so the compiler correctly identifies libcudart.



Any chance of clarifying this?



Edit: Btw deviceQuery and bandwithTest pass successfully.

#3
Posted 01/19/2010 03:11 PM   
[SOLVED]

In case anyone else run into the same problem... Solution: Matlab has a seperate variable environment when executing mex functions. type "!export LD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PAT" ($LD_LIBRARY_PATH on Windows) in the Matlab command window or type "unix('otool -L foo.mex')" to get dylib dependencies of your function and copy dylibs into either of the directories returned by "!echo $DYLD_LIBRARY_PATH".
[SOLVED]



In case anyone else run into the same problem... Solution: Matlab has a seperate variable environment when executing mex functions. type "!export LD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PAT" ($LD_LIBRARY_PATH on Windows) in the Matlab command window or type "unix('otool -L foo.mex')" to get dylib dependencies of your function and copy dylibs into either of the directories returned by "!echo $DYLD_LIBRARY_PATH".

#4
Posted 01/21/2010 05:58 PM   
Scroll To Top