library problems


I’m having a little problem which is really frustrating me. My installation of CUDA all goes to plan. The examples work great. deviceQuery runs fine, as does bandwidthTest. However when I try to run a program I have written it gives me the error:

dyld: Library not loaded: @rpath/libcudart.dylib
Referenced from : /blah/blah
Reason: image not found
Trace/BPT trap

All my path variables are set up correctly. I have checked. I am compiling simply by nvcc -o blah

The same code works on my other machine without problems. What could the problem be here?


When you say “All my path variables are set up correctly”, does that mean DYLD_LIBRARY_PATH includes where the toolkit libraries installed? (should be /usr/local/cuda/lib by default)

Correct. and $PATH usr/local/cuda/bin

I am facing a similar problem on both linux and mac osx.

Also for big projects mixing c/c++ and cuda I build using the that the CUDA sdk provides. It is a very nice engine and you can customize it with new flags. It is a great way for building your code. I am surprised that people are not using it as a reference as it is or build from it a new common file.



I got the same problem in the samples.

The installations of all the parts ( Driver, Toolkit, SDK) went fine, but i suppose i failed in " setting my path variables correctly ".
I red about this two commands :

export PATH=/usr/local/cuda/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/cuda/lib:$DYLD_LIBRARY_PATH

where i should be before executing them?
should i complete theme in some way for my own document tree ?

How can I place them in ~/.bash_profile since I do not have any?
Should i create it ?

Thanks in advance for your help, I’m just a student, but I have been fascinated by this argument and I’d like to practice.
Forgive me for my bad english, but I’m Italian. :D


Yes, just create a file in your home directory called .bash_profile, put the export commands in there then run “source .bash_profile” and you should be up and running.


Stop messing with scripts and “export” commands. Just tell the binary where to look, with install_name_tool. I do, and my CUDA programs (full application bundles) are double-clickable, with no script editing needed (for running it, that is - building is another matter).

Is there an install_name_tool or similar for Linux?