开发者

Can't find /lib/libJOCL-linux-x86.so

开发者 https://www.devze.com 2023-02-09 23:03 出处:网络
I have a NVida graphic card and I would like to use it for serious computations. I downloaded a driver from NVida webside and installed JOCL bindings. I downloaded one of the demo programs and compile

I have a NVida graphic card and I would like to use it for serious computations. I downloaded a driver from NVida webside and installed JOCL bindings. I downloaded one of the demo programs and compiled it. The program however does not run because:

> Error while loading native library
> "JOCL-linux-x86" with base name "JOCL"
> Operating syste开发者_运维百科m name: Linux
> Architecture : i386 Architecture bit
> size: 32 Stack trace from the attempt
> to load the library as a resource:
> java.lang.NullPointerException: No
> resource found with name
> '/lib/libJOCL-linux-x86.so' at
> org.jocl.LibUtils.loadLibraryResource(LibUtils.jav
> a:139) at
> org.jocl.LibUtils.loadLibrary(LibUtils.java:83)
> at org.jocl.CL.<clinit>(CL.java:47) at
> JOCLSample.main(JOCLSample.java:50)
> Stack trace from the attempt to load
> the library as a file:
> java.lang.UnsatisfiedLinkError: no
> JOCL-linux-x86 in java.library.path at
> java.lang.ClassLoader.loadLibrary(ClassLoader.java
> :1681) at
> java.lang.Runtime.loadLibrary0(Runtime.java:840)
> at
> java.lang.System.loadLibrary(System.java:1047)
> at
> org.jocl.LibUtils.loadLibrary(LibUtils.java:93)
> at org.jocl.CL.<clinit>(CL.java:47) at
> JOCLSample.main(JOCLSample.java:50)
> Exception in thread "main"
> java.lang.UnsatisfiedLinkError: Could
> not load the native library at
> org.jocl.LibUtils.loadLibrary(LibUtils.java:117)
> at org.jocl.CL.<clinit>(CL.java:47) at
> JOCLSample.main(JOCLSample.java:50)

Trying to solve it I did the following:

  • I am positive that "JOCL-0.1.4d.jar" file is properly added to classpath; /lib/libJOCL-linux-x86_64.so for sure is inside this jar

  • I also extracted libJOCL-linux-x86_64.so form the jar and used a respective -Djava.library.path= command.

  • The libJOCL-linux-x86_64.so library is also on my LD_LIBRARY_PATH

  • I also run ldconfig in the proper directory to index this library

but the problem persists


According to the error message you're running this in a 32 bit VM, which would mean that you'd need the 32bit .so file (or switch to using a 64bit JVM).

Note that Java usually loads .so files from the java.library.path (and not necessarily from LD_LIBRARY_PATH).

0

精彩评论

暂无评论...
验证码 换一张
取 消