ochafik/nativelibs4java — Issue #221: Problem with ScalaCL 0.3: Bridj fails to initialize
Author: jHackTheRipper
Created: 2012-01-01 21:57:30+00:00
State: open

Hi Olivier,

I tried to use ScalaCL v0.3-SNAPSHOT through Maven but I couldn't get any verbose output of the generated kernels like I used to get in o.2 by setting SCALACL_VERBOSE=1.

So, I built a sbaz package from the jars available on your Maven repository in order to try my code in the scala shell.
However, when I try to initialize the ScalaCL context, I get a java.lang.RuntimeException: Failed to initialize BridJ.

I think I'm doing something wrong because the exception is raised in both MacOS and Linux environments.

Here is the complete stacktrace that is printed:

Welcome to Scala version 2.9.1.final (OpenJDK 64-Bit Server VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import scalacl._
import scalacl._

scala> implicit val context = Context.best
java.lang.RuntimeException: Failed to initialize BridJ
at org.bridj.Platform.initLibrary(Platform.java:311)
at org.bridj.Platform.(Platform.java:123)
at org.bridj.CRuntime.(CRuntime.java:450)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at org.bridj.BridJ.getRuntimeByRuntimeClass(BridJ.java:230)
at org.bridj.BridJ.getRuntime(BridJ.java:261)
at org.bridj.BridJ.register(BridJ.java:284)
at org.bridj.BridJ.register(BridJ.java:158)
at com.nativelibs4java.opencl.JavaCL$OpenCLProbeLibrary.(JavaCL.java:94)
at com.nativelibs4java.opencl.JavaCL.(JavaCL.java:120)
at scalacl.Context.(ScalaCL.scala:16)
at scalacl.Context$.best(ScalaCL.scala:28)
at $line2.$read$$iw$$iw$$iw$$iw$.(:10)
at $line2.$read$$iw$$iw$$iw$$iw$.()
at $line2.$eval$.(:11)
at $line2.$eval$.()
at $line2.$eval.$print()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NullPointerException
at org.bridj.Platform.extractEmbeddedLibraryResource(Platform.java:490)
at org.bridj.Platform.initLibrary(Platform.java:285)
... 30 more
java.lang.UnsatisfiedLinkError: org.bridj.Platform.sizeOf_ptrdiff_t()I
at org.bridj.Platform.sizeOf_ptrdiff_t(Native Method)
at org.bridj.Platform.(Platform.java:128)
at org.bridj.CRuntime.(CRuntime.java:450)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at org.bridj.BridJ.getRuntimeByRuntimeClass(BridJ.java:230)
at org.bridj.BridJ.getRuntime(BridJ.java:261)
at org.bridj.BridJ.register(BridJ.java:284)
at org.bridj.BridJ.register(BridJ.java:158)
at com.nativelibs4java.opencl.JavaCL$OpenCLProbeLibrary.(JavaCL.java:94)
at com.nativelibs4java.opencl.JavaCL.(JavaCL.java:120)
at scalacl.Context.(ScalaCL.scala:16)
at scalacl.Context$.best(ScalaCL.scala:28)
at .(:10)
at .()
at .(:11)
at .()
at $print()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
at java.lang.Thread.run(Thread.java:679)

Thanks by advance for your help, I'm really looking forward to using ScalaCL 0.3 features!