Login  Register

OSX: "OpenCL library not found"

Posted by felix on Dec 14, 2011; 7:24pm
URL: https://forum.jogamp.org/OSX-OpenCL-library-not-found-tp3586437.html

Hi,

I'm trying to get started with JOCL on OSX 10.6.8. Unfortunately the native (OSX) OpenCL library/framework cannot be loaded. (note: libjocl.dylib is found) Creating a context:
"CLContext context = CLContext.create();"
results in the following exception (full stacktrace at the end of this post):
Exception in thread "main" com.jogamp.common.JogampRuntimeException: JOCL initialization error.
Caused by: com.jogamp.common.JogampRuntimeException: OpenCL library not found.

As far as I can see from the Gluegen code it should not be necessary to add "/System/Library/Frameworks" to the library path. However doing so does not help.

I did some "debugging" and found that somewhere in CLContext.java the OpenCL library ist loaded using the following call:
NativeLibrary test = NativeLibrary.open("OpenCL", myClassLoader);
For some reason this call returns "null" on my system. Calling it with the absolute path to a symlink of the library like this:
NativeLibrary test = NativeLibrary.open("/System/Library/Frameworks/OpenCL.framework/OpenCL", myClassLoader);
returns the desired library.

However, I can't get JOCL to correctly load the framework. Am I missing something or might this be a bug in the Gluegen sources?

Any help is very welcome, thank you.

Full stack trace and JOCL version:
-----------------------------------------------------------------------------------------------------
Platform: MACOS / Mac OS X 10.6.8 (os), x86_64 (arch) 8 cores
MachineDescription: runtimeValidated true, littleEndian true, 32Bit false, primitive size / alignment:
  int8    1 / 1, int16   2 / 2
  int     4 / 4, long    8 / 8
  int32   4 / 4, int64   8 / 8
  float   4 / 4, double  8 / 8, ldouble 16 / 16
  pointer 8 / 8, page    4096
Platform: Java Version: 1.6.0_29, VM: Java HotSpot(TM) 64-Bit Server VM, Runtime: Java(TM) SE Runtime Environment
Platform: Java Vendor: Apple Inc., http://www.apple.com/, is JavaSE: true
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
Package: com.jogamp.opencl
Extension Name: com.jogamp.opencl
Specification Title: Java Bindings for OpenCL
Specification Vendor: JogAmp Community
Specification Version: 0.9
Implementation Title: Java Bindings for OpenCL
Implementation Vendor: JogAmp Community
Implementation Vendor ID: com.jogamp
Implementation URL: http://jocl.jogamp.org/
Implementation Version: 0.9-b28-20111202
Implementation Branch: rc
Implementation Commit: 70407434fd4cd205b127ed7d73832eb0b3d01263
-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------
Package: com.jogamp.common
Extension Name: com.jogamp.common
Specification Title: GlueGen Java Bindings Generator
Specification Vendor: JogAmp Community
Specification Version: 2.0
Implementation Title: GlueGen Run-Time
Implementation Vendor: JogAmp Community
Implementation Vendor ID: com.jogamp
Implementation URL: http://jogamp.org/
Implementation Version: 2.0-b32-20111202
Implementation Branch: rc
Implementation Commit: e5aaa05c071e311f1f0d8298dce268a3b44d32ea
-----------------------------------------------------------------------------------------------------
Exception in thread "main" com.jogamp.common.JogampRuntimeException: JOCL initialization error.
        at com.jogamp.opencl.CLPlatform.initialize(CLPlatform.java:220)
        at com.jogamp.opencl.CLPlatform.initialize(CLPlatform.java:148)
        at com.jogamp.opencl.CLPlatform.getDefault(CLPlatform.java:229)
        at com.jogamp.opencl.CLContext.create(CLContext.java:170)
        at com.jogamp.opencl.CLContext.create(CLContext.java:145)
        at ImagePyramide.allocate(ImagePyramide.java:39)
        at ImagePyramide.<init>(ImagePyramide.java:23)
        at FreeCamTest.main(FreeCamTest.java:6)
Caused by: com.jogamp.common.JogampRuntimeException: OpenCL library not found.
        at com.jogamp.opencl.CLPlatform$2.run(CLPlatform.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.opencl.CLPlatform.initialize(CLPlatform.java:196)
        ... 7 more