Calling JCuda from ImageJ on a Mac OSX


Sorry to boring you with yet another “java.lang.UnsatisfiedLinkError” but I read and tried all possible configuration to call a Cuda program from an Image/Fiji on a Mac.

I’m try to run the simple provided on the JCuda website. I have install the CUDA developper SDK and following all the instructions that I have found on the website /forum /FAQ. I copy all the dylib in many places like:
/usr/local/bin and /lib/
ImageJ/plugins/ and ImageJ/jars,
/Library/Java/Extensions and /System/Library/Java/Extensions.
I make a copy of libraries and rename them jnilib.
All the tests conduct to the same following error:
java.lang.UnsatisfiedLinkError: /Library/Java/Extensions/libJCudaDriver-apple-x86_64.dylib: dlopen(/Library/Java/Extensions/libJCudaDriver-apple-x86_64.dylib, 1): Library not loaded: @rpath/libcudart.dylib
java.lang.NullPointerException: No resource found with name ‘/lib/libJCudaDriver-apple-x86_64.jnilib’

MacOSX Version: 10.8.5
Java version: 1.7.0_25
ImageJ version: 1.47v
ARCH: x86_64
Libraries CUDA: Binaries MacOSX downloaded from the website of JCuda: 0.5.0a build 35
Current directory: /Users//Desktop/ImageJ
java.library.path: /Users/big/Desktop/ImageJ/

Thank you in advance in a pointer to a solution.



My possibilities for running tests on MacOS are rather limited (that is: not existent -_- ). So I’ll try to dissect the information that you provided:

  • First of all: Which version of the CUDA Toolkit/SDK did you install? Note that JCuda 0.5.0a was built for CUDA 5.0. If you installed the newest CUDA version (5.5) then the binaries of JCuda 0.5.0a will probably not work. (Until now, none of the contributors provided the MacOS binaries for the latest CUDA version, but I can try to contact the contributors who provided the previous versions, and ask them for an update).

  • Can you run the “Basic test” that is described at ? (Just to see whether it is some general problem, or specific for ImageJ…)

  • The file extensions for the JCuda binaries should be DYLIB (I noticed that the Tutorial still talks about JNILIBs, I’ll update this ASAP)

  • At least on Windows, it worked for me to simply place the binaries (that is, the DLLs, or DYLIBS in your case) into the main ImageJ directory, or into the main Fiji directory, respectively. (This was not contained in your ‘List of directories where you copied the files’, so I’m mentioning it here ;))

  • Do you have a ‘libcudart.dylib’ on your system? (It should be present, if the CUDA toolkit was installed properly, I’m just asking because of the error message, mentioning ‘Library not loaded: @rpath/libcudart.dylib’)